﻿Imports WSEntidades
Public Class csUtilsAddendaAMC
    Private cadenaComercial As String
    Public Function ProcesaConfig(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium))
        Try
            If (currentrow.Length = 5 And currentrow(0) = "12") Then
                If (currentrow(1) = "CVEADD") Then
                    If (currentrow(2) <> "" And currentrow(2) = "AMC7.1") Then
                        cadenaComercial = currentrow(2)
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 3, "El contenido del documento TXT no es correcto. Clave Incorrecta.", Resp)
                    End If
                Else
                    ValidaCFDi.AgregaRespuesta("12", 2, "El contenido del documento TXT no es correcto. La seccion 12 no contiene el indicador CVEADD", Resp)
                End If
            Else
                ValidaCFDi.AgregaRespuesta("12", 1, "El contenido del documento TXT no es correcto. La seccion 12 no corresponde con el formato especificado", Resp)
            End If
            Return True
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaEncabezado(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium), _
                                      ByRef add As AMC71.ComprobanteAddenda, ByVal tipoCFD As String, _
                                      ByVal comprobante As Comprobante)
        Try
            If (currentrow.Length = 5) Then
                add.requestForPayment = New AMC71.ComprobanteAddendaRequestForPayment()
                add.requestForPayment.type = currentrow(1).Trim
                If (currentrow(2).Trim <> "") Then
                    add.requestForPayment.contentVersion = currentrow(2).Trim
                End If
                If (currentrow(3).Trim <> "") Then
                    add.requestForPayment.documentStructureVersion = currentrow(3).Trim
                Else
                    ValidaCFDi.AgregaRespuesta("12", 4, "El dato documentStructureVersion de AMC es requerido.", Resp)
                End If
                If (currentrow(4).Trim <> "") Then
                    Select Case currentrow(4).Trim.ToUpper
                        Case "ORIGINAL"
                            add.requestForPayment.documentStatus = AMC71.ComprobanteAddendaRequestForPaymentDocumentStatus.ORIGINAL
                        Case "COPY"
                            add.requestForPayment.documentStatus = AMC71.ComprobanteAddendaRequestForPaymentDocumentStatus.COPY
                        Case "REEMPLAZA"
                            add.requestForPayment.documentStatus = AMC71.ComprobanteAddendaRequestForPaymentDocumentStatus.REEMPLAZA
                        Case "DELETE"
                            add.requestForPayment.documentStatus = AMC71.ComprobanteAddendaRequestForPaymentDocumentStatus.DELETE
                        Case Else
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato documentStatus de AMC tiene un valor incorrecto.", Resp)
                    End Select
                Else
                    ValidaCFDi.AgregaRespuesta("12", 5, "El dato documentStatus de AMC es requerido.", Resp)
                End If
                add.requestForPayment.DeliveryDate = DateTime.Now()
                add.requestForPayment.DeliveryDateSpecified = True
                add.requestForPayment.requestForPaymentIdentification = New AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentification()
                Select Case tipoCFD.Trim.ToUpper()
                    Case "FA"
                        add.requestForPayment.requestForPaymentIdentification.entityType = AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentificationEntityType.INVOICE
                    Case "CR"
                        add.requestForPayment.requestForPaymentIdentification.entityType = AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentificationEntityType.CREDIT_NOTE
                    Case "CA"
                        add.requestForPayment.requestForPaymentIdentification.entityType = AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentificationEntityType.DEBIT_NOTE
                    Case "RH"
                        add.requestForPayment.requestForPaymentIdentification.entityType = AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentificationEntityType.HONORARY_RECEIPT
                    Case "CP"
                        add.requestForPayment.requestForPaymentIdentification.entityType = AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentificationEntityType.TRANSPORT_DOCUMENT
                    Case "RA"
                        add.requestForPayment.requestForPaymentIdentification.entityType = AMC71.ComprobanteAddendaRequestForPaymentRequestForPaymentIdentificationEntityType.LEASE_RECEIPT
                    Case Else
                        ValidaCFDi.AgregaRespuesta("12", 0, "El dato entityType (requestForPaymentIdentification) de AMC tiene un valor incorrecto.", Resp)
                End Select
                add.requestForPayment.requestForPaymentIdentification.uniqueCreatorIdentification = "Temp"
                add.requestForPayment.baseAmount = New AMC71.ComprobanteAddendaRequestForPaymentBaseAmount()
                add.requestForPayment.baseAmount.Amount = comprobante.subTotal
                add.requestForPayment.payableAmount = New AMC71.ComprobanteAddendaRequestForPaymentPayableAmount()
                add.requestForPayment.payableAmount.Amount = comprobante.total
                Dim Valid As New AMC
                ''Llamamos al método de validación de Karo.!
                If (Valid.isValid_Encabezado(Resp, add)) Then
                    Return True
                Else
                    Return False
                End If
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección ENCABEZADO", Resp)
                Return False
            End If

        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaSpecialIns(ByVal currentrow As String(), _
                                      ByRef Resp As List(Of RespuestaPremium), _
                                      ByRef add As AMC71.ComprobanteAddenda)
        Try
            'Llenamos SpecialIns

            If (currentrow.Length = 18) Then
                If (add.requestForPayment.specialInstruction Is Nothing) Then
                    add.requestForPayment.specialInstruction = New AMC71.ComprobanteAddendaRequestForPaymentSpecialInstruction() {New AMC71.ComprobanteAddendaRequestForPaymentSpecialInstruction()}
                    If (currentrow(2).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato code (2) en la seccion SPECIALINS de AMC.", Resp)
                    Else
                        Select Case currentrow(2).Trim.ToUpper()
                            Case "AAB"
                                add.requestForPayment.specialInstruction(0).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.AAB
                            Case "DUT"
                                add.requestForPayment.specialInstruction(0).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.DUT
                            Case "PUR"
                                add.requestForPayment.specialInstruction(0).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.PUR
                            Case "ZZZ"
                                add.requestForPayment.specialInstruction(0).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.ZZZ
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar un valor correcto en el campo code de la seccion SPECIALINS", Resp)
                        End Select
                    End If
                    add.requestForPayment.specialInstruction(0).text1 = New String() {}
                    If (currentrow(3).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar el dato Text (3) de la seccion SPECIALINS de AMC.", Resp)
                    Else
                        If (currentrow(3).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 4, "El dato Text (3) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(1)
                        add.requestForPayment.specialInstruction(0).text1(0) = currentrow(3).Trim
                    End If
                    If (currentrow(4).Trim <> "") Then
                        If (currentrow(4).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato Text (4) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(2)
                        add.requestForPayment.specialInstruction(0).text1(1) = currentrow(4).Trim
                    End If
                    If (currentrow(5).Trim <> "") Then
                        If (currentrow(5).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 6, "El dato Text (5) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(3)
                        add.requestForPayment.specialInstruction(0).text1(2) = currentrow(5).Trim
                    End If
                    If (currentrow(6).Trim <> "") Then
                        If (currentrow(6).Trim.Length > 255) Then
                            Throw New Exception("El dato Text (6) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.")
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(4)
                        add.requestForPayment.specialInstruction(0).text1(3) = currentrow(6).Trim
                    End If
                    If (currentrow(7).Trim <> "") Then
                        If (currentrow(7).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 8, "El dato Text (7) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(5)
                        add.requestForPayment.specialInstruction(0).text1(4) = currentrow(7).Trim
                    End If
                    If (currentrow(8).Trim <> "") Then
                        If (currentrow(8).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 9, "El dato Text (8) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(6)
                        add.requestForPayment.specialInstruction(0).text1(5) = currentrow(8).Trim
                    End If
                    If (currentrow(9).Trim <> "") Then
                        If (currentrow(9).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 10, "El dato Text (9) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(7)
                        add.requestForPayment.specialInstruction(0).text1(6) = currentrow(9).Trim
                    End If
                    If (currentrow(10).Trim <> "") Then
                        If (currentrow(10).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 11, "El dato Text (10) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(8)
                        add.requestForPayment.specialInstruction(0).text1(7) = currentrow(10).Trim
                    End If
                    If (currentrow(11).Trim <> "") Then
                        If (currentrow(11).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 12, "El dato Text (11) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(9)
                        add.requestForPayment.specialInstruction(0).text1(8) = currentrow(11).Trim
                    End If
                    If (currentrow(12).Trim <> "") Then
                        If (currentrow(12).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 13, "El dato Text (12) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(10)
                        add.requestForPayment.specialInstruction(0).text1(9) = currentrow(12).Trim
                    End If
                    If (currentrow(13).Trim <> "") Then
                        If (currentrow(13).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 14, "El dato Text (13) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(11)
                        add.requestForPayment.specialInstruction(0).text1(10) = currentrow(13).Trim
                    End If
                    If (currentrow(14).Trim <> "") Then
                        If (currentrow(14).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 15, "El dato Text (14) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(12)
                        add.requestForPayment.specialInstruction(0).text1(11) = currentrow(14).Trim
                    End If
                    If (currentrow(15).Trim <> "") Then
                        If (currentrow(15).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 16, "El dato Text (15) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(13)
                        add.requestForPayment.specialInstruction(0).text1(12) = currentrow(15).Trim
                    End If
                    If (currentrow(16).Trim <> "") Then
                        If (currentrow(16).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 17, "El dato Text (16) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(14)
                        add.requestForPayment.specialInstruction(0).text1(13) = currentrow(16).Trim
                    End If
                    If (currentrow(17).Trim <> "") Then
                        If (currentrow(17).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 18, "El dato Text (17) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(0).text1(15)
                        add.requestForPayment.specialInstruction(0).text1(14) = currentrow(17).Trim
                    End If
                Else
                    ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length)
                    add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentSpecialInstruction()
                    If (currentrow(2).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato code (2) en la seccion SPECIALINS de AMC", Resp)
                    Else
                        Select Case currentrow(2).Trim.ToUpper()
                            Case "AAB"
                                add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.AAB
                            Case "DUT"
                                add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.DUT
                            Case "PUR"
                                add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.PUR
                            Case "ZZZ"
                                add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).code = AMC71.ComprobanteAddendaRequestForPaymentSpecialInstructionCode.ZZZ
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar un valor correcto en el campo code de la seccion SPECIALINS", Resp)
                        End Select
                    End If
                    add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1 = New String() {}
                    If (currentrow(3).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar el dato Text (3) de la seccion SPECIALINS de AMC.", Resp)
                    Else
                        If (currentrow(3).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 4, "El dato Text (3) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(1)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(0) = currentrow(3).Trim
                    End If
                    If (currentrow(4).Trim <> "") Then
                        If (currentrow(4).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato Text (4) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(2)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(1) = currentrow(4).Trim
                    End If
                    If (currentrow(5).Trim <> "") Then
                        If (currentrow(5).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 6, "El dato Text (5) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(3)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(2) = currentrow(5).Trim
                    End If
                    If (currentrow(6).Trim <> "") Then
                        If (currentrow(6).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 7, "El dato Text (6) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(4)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(3) = currentrow(6).Trim
                    End If
                    If (currentrow(7).Trim <> "") Then
                        If (currentrow(7).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 8, "El dato Text (7) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(5)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(4) = currentrow(7).Trim
                    End If
                    If (currentrow(8).Trim <> "") Then
                        If (currentrow(8).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 9, "El dato Text (8) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(6)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(5) = currentrow(8).Trim
                    End If
                    If (currentrow(9).Trim <> "") Then
                        If (currentrow(9).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 10, "El dato Text (9) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(7)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(6) = currentrow(9).Trim
                    End If
                    If (currentrow(10).Trim <> "") Then
                        If (currentrow(10).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 11, "El dato Text (10) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(8)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(7) = currentrow(10).Trim
                    End If
                    If (currentrow(11).Trim <> "") Then
                        If (currentrow(11).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 12, "El dato Text (11) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(9)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(8) = currentrow(11).Trim
                    End If
                    If (currentrow(12).Trim <> "") Then
                        If (currentrow(12).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 13, "El dato Text (12) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(10)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(9) = currentrow(12).Trim
                    End If
                    If (currentrow(13).Trim <> "") Then
                        If (currentrow(13).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 14, "El dato Text (13) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(11)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(10) = currentrow(13).Trim
                    End If
                    If (currentrow(14).Trim <> "") Then
                        If (currentrow(14).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 15, "El dato Text (14) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(12)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(11) = currentrow(14).Trim
                    End If
                    If (currentrow(15).Trim <> "") Then
                        If (currentrow(15).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 16, "El dato Text (15) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(13)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(12) = currentrow(15).Trim
                    End If
                    If (currentrow(16).Trim <> "") Then
                        If (currentrow(16).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 17, "El dato Text (16) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(14)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(13) = currentrow(16).Trim
                    End If
                    If (currentrow(17).Trim <> "") Then
                        If (currentrow(17).Trim.Length > 255) Then
                            ValidaCFDi.AgregaRespuesta("12", 18, "El dato Text (17) de la seccion SPECIALINS de AMC no puede ser de longitud mayor a 255 caracteres.", Resp)
                        End If
                        ReDim Preserve add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length).text1(15)
                        add.requestForPayment.specialInstruction(add.requestForPayment.specialInstruction.Length - 1).text1(14) = currentrow(17).Trim
                    End If
                End If
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección SPECIALINS", Resp)
            End If

            Return True

        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaOrder(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium), _
                                 ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 5) Then
                If (currentrow(2) = "ORDER") Then
                    add.requestForPayment.orderIdentification = New AMC71.ComprobanteAddendaRequestForPaymentOrderIdentification()
                    add.requestForPayment.orderIdentification.referenceIdentification = New AMC71.ComprobanteAddendaRequestForPaymentOrderIdentificationReferenceIdentification() {New AMC71.ComprobanteAddendaRequestForPaymentOrderIdentificationReferenceIdentification()}
                    If (currentrow(4).Trim.Length > 35) Then
                        add.requestForPayment.orderIdentification.referenceIdentification(0).Value = currentrow(4).Trim.Substring(0, 35)
                    Else
                        add.requestForPayment.orderIdentification.referenceIdentification(0).Value = currentrow(4).Trim
                    End If
                    add.requestForPayment.orderIdentification.referenceIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentOrderIdentificationReferenceIdentificationType.ON
                Else
                    ValidaCFDi.AgregaRespuesta("12", 3, "El contenido de la seccion ORDERID tiene un valor incorrecto.", Resp)
                End If
            ElseIf (currentrow.Length = 4) Then
                If (currentrow(2) = "DATE") Then
                    add.requestForPayment.orderIdentification.ReferenceDate = Convert.ToDateTime(currentrow(3).Trim)
                    add.requestForPayment.orderIdentification.ReferenceDateSpecified = True
                End If
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección ORDERID", Resp)
            End If
            Return True
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaAditional(ByVal currentrow As String(), _
                                 ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 4) Then
                ReDim add.requestForPayment.AdditionalInformation(0)
                add.requestForPayment.AdditionalInformation(0) = New AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentification()
                If (currentrow(2).Trim <> "") Then
                    Select Case currentrow(2).Trim
                        Case "AAE"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.AAE
                        Case "CK"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.CK
                        Case "ACE"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.ACE
                        Case "ATZ"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.ATZ
                        Case "AWR"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.AWR
                        Case "ON"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.ON
                        Case "DQ"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.DQ
                        Case "IV"
                            add.requestForPayment.AdditionalInformation(0).type = AMC71.ComprobanteAddendaRequestForPaymentReferenceIdentificationType.IV
                        Case Else
                            ValidaCFDi.AgregaRespuesta("12", 3, "El dato type de la seccion ADDITIONALINF tiene un valor incorrecto.", Resp)
                    End Select
                Else
                    ValidaCFDi.AgregaRespuesta("12", 3, "El dato type de la seccion ADDITIONALINF es requerido.", Resp)
                End If
                If (currentrow(3).Trim <> "") Then
                    If (currentrow(3).Trim.Length > 35) Then
                        add.requestForPayment.AdditionalInformation(0).Value = currentrow(3).Trim.Substring(0, 35)
                    Else
                        add.requestForPayment.AdditionalInformation(0).Value = currentrow(3).Trim
                    End If
                Else
                    ValidaCFDi.AgregaRespuesta("12", 4, "El dato value de la seccion ADDITIONALINF es requerido.", Resp)
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección ADDITIONALINF", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaDeliveryNote(ByVal currentrow As String(), _
                                 ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 4) Then
                If (currentrow(2).Trim = "NOTE") Then
                    add.requestForPayment.DeliveryNote = New AMC71.ComprobanteAddendaRequestForPaymentDeliveryNote()
                    If (currentrow(3).Trim.Length > 35) Then
                        add.requestForPayment.DeliveryNote.referenceIdentification = New String() {currentrow(3).Trim.Substring(0, 35)}
                    Else
                        add.requestForPayment.DeliveryNote.referenceIdentification = New String() {currentrow(3).Trim}
                    End If
                    Return True
                ElseIf (currentrow(2).Trim = "DATE") Then
                    add.requestForPayment.DeliveryNote.ReferenceDate = Convert.ToDateTime(currentrow(3).Trim)
                    add.requestForPayment.DeliveryNote.ReferenceDateSpecified = True
                    Return True
                Else
                    ValidaCFDi.AgregaRespuesta("12", 3, "El contenido de la seccion DELIVERYNOTE tiene un valor incorrecto.", Resp)
                    Return False
                End If
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección DELIVERYNOTE", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaBuyer(ByVal currentrow As String(), _
                                 ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try

            If (currentrow.Length = 4) Then
                add.requestForPayment.buyer = New AMC71.ComprobanteAddendaRequestForPaymentBuyer()
                If (currentrow(2).Trim <> "") Then
                    If (currentrow(2).Trim.Length <> 13) Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "El gln de la seccion Buyer debe ser de longitud 13.", Resp)
                    Else
                        add.requestForPayment.buyer.gln = currentrow(2).Trim
                    End If
                Else
                    ValidaCFDi.AgregaRespuesta("12", 3, "El dato gln de la seccion Buyer es requerido.", Resp)
                End If
                If (currentrow(3).Trim <> "") Then
                    add.requestForPayment.buyer.contactInformation = New AMC71.ComprobanteAddendaRequestForPaymentBuyerContactInformation()
                    add.requestForPayment.buyer.contactInformation.personOrDepartmentName = New AMC71.ComprobanteAddendaRequestForPaymentBuyerContactInformationPersonOrDepartmentName()
                    If (currentrow(3).Trim.Length > 35) Then
                        add.requestForPayment.buyer.contactInformation.personOrDepartmentName.text = currentrow(3).Trim.Substring(0, 35)
                    Else
                        add.requestForPayment.buyer.contactInformation.personOrDepartmentName.text = currentrow(3).Trim
                    End If
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección BUYER", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaSeller(ByVal currentrow As String(), _
                             ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try

            If (currentrow.Length = 5) Then
                add.requestForPayment.seller = New AMC71.ComprobanteAddendaRequestForPaymentSeller()
                If (currentrow(2).Trim <> "") Then
                    If (currentrow(2).Trim.Length <> 13) Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "El gln de la seccion Seller debe ser de longitud 13.", Resp)
                    Else
                        add.requestForPayment.seller.gln = currentrow(2).Trim
                    End If
                Else
                    ValidaCFDi.AgregaRespuesta("12", 3, "El dato gln de la seccion Seller es requerido.", Resp)
                End If
                If (currentrow(3).Trim <> "") Then
                    add.requestForPayment.seller.alternatePartyIdentification = New AMC71.ComprobanteAddendaRequestForPaymentSellerAlternatePartyIdentification()
                    Select Case currentrow(3).Trim
                        Case "SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY"
                            add.requestForPayment.seller.alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentSellerAlternatePartyIdentificationType.SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY
                        Case "IEPS_REFERENCE"
                            add.requestForPayment.seller.alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentSellerAlternatePartyIdentificationType.IEPS_REFERENCE
                    End Select
                Else
                    ValidaCFDi.AgregaRespuesta("12", 4, "El dato type de la seccion SELLER es requerido.", Resp)
                End If
                If (currentrow(4).Trim <> "") Then
                    If (currentrow(4).Trim.Length > 35) Then
                        add.requestForPayment.seller.alternatePartyIdentification.Value = currentrow(4).Trim.Substring(0, 35)
                    Else
                        add.requestForPayment.seller.alternatePartyIdentification.Value = currentrow(4).Trim
                    End If
                Else
                    ValidaCFDi.AgregaRespuesta("12", 5, "El dato alternatePartyIdentification de la seccion SELLER es requerido.", Resp)
                    Return False
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección BUYER", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaShipto(ByVal currentrow As String(), _
                                 ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 7) Then
                add.requestForPayment.shipTo = New AMC71.ComprobanteAddendaRequestForPaymentShipTo()
                If (currentrow(2).Trim <> "") Then
                    If (currentrow(2).Trim.Length <> 13) Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "El gln de la seccion Shipto debe ser de longitud 13.", Resp)
                    Else
                        add.requestForPayment.buyer.gln = currentrow(2).Trim
                    End If
                End If
                If (currentrow(3).Trim <> "" Or currentrow(4).Trim <> "" Or currentrow(5).Trim <> "" Or currentrow(6).Trim <> "") Then
                    add.requestForPayment.shipTo.nameAndAddress = New AMC71.ComprobanteAddendaRequestForPaymentShipToNameAndAddress()
                    If (currentrow(3).Trim <> "") Then
                        ReDim add.requestForPayment.shipTo.nameAndAddress.name(0)
                        If (currentrow(3).Trim.Length > 35) Then
                            add.requestForPayment.shipTo.nameAndAddress.name(0) = currentrow(3).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.shipTo.nameAndAddress.name(0) = currentrow(3).Trim
                        End If
                    End If
                    If (currentrow(4).Trim <> "") Then
                        ReDim add.requestForPayment.shipTo.nameAndAddress.streetAddressOne(0)
                        If (currentrow(4).Trim.Length > 35) Then
                            add.requestForPayment.shipTo.nameAndAddress.streetAddressOne(0) = currentrow(4).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.shipTo.nameAndAddress.streetAddressOne(0) = currentrow(4).Trim
                        End If
                    End If
                    If (currentrow(5).Trim <> "") Then
                        ReDim add.requestForPayment.shipTo.nameAndAddress.city(0)
                        If (currentrow(5).Trim.Length > 35) Then
                            add.requestForPayment.shipTo.nameAndAddress.city(0) = currentrow(5).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.shipTo.nameAndAddress.city(0) = currentrow(5).Trim
                        End If
                    End If
                    If (currentrow(6).Trim <> "") Then
                        ReDim add.requestForPayment.shipTo.nameAndAddress.postalCode(0)
                        If (currentrow(6).Trim.Length > 9) Then
                            add.requestForPayment.shipTo.nameAndAddress.postalCode(0) = currentrow(6).Trim.Substring(0, 9)
                        Else
                            add.requestForPayment.shipTo.nameAndAddress.postalCode(0) = currentrow(6).Trim
                        End If
                    End If
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección SHIPTO", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaInvoiceCreator(ByVal currentrow As String(), _
                                 ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 9) Then
                add.requestForPayment.InvoiceCreator = New AMC71.ComprobanteAddendaRequestForPaymentInvoiceCreator()
                If (currentrow(2).Trim <> "") Then
                    If (currentrow(2).Trim.Length <> 13) Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "El gln de la seccion InoviceCreator debe ser de longitud 13.", Resp)
                    Else
                        add.requestForPayment.InvoiceCreator.gln = currentrow(2).Trim
                    End If
                End If
                If (currentrow(3).Trim <> "" Or currentrow(4).Trim <> "") Then
                    add.requestForPayment.InvoiceCreator.alternatePartyIdentification = New AMC71.ComprobanteAddendaRequestForPaymentInvoiceCreatorAlternatePartyIdentification()
                    If (currentrow(3).Trim <> "") Then
                        Select Case currentrow(3).Trim
                            Case "VA"
                                add.requestForPayment.InvoiceCreator.alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentInvoiceCreatorAlternatePartyIdentificationType.VA
                            Case "IA"
                                add.requestForPayment.InvoiceCreator.alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentInvoiceCreatorAlternatePartyIdentificationType.IA
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 4, "El dato type de la seccion INVOICECREATOR tiene un valor incorrecto.", Resp)
                        End Select
                    End If
                    If (currentrow(4).Trim <> "") Then
                        If (currentrow(4).Trim.Length > 35) Then
                            add.requestForPayment.InvoiceCreator.alternatePartyIdentification.Value = currentrow(4).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.InvoiceCreator.alternatePartyIdentification.Value = currentrow(4).Trim
                        End If
                    End If
                End If
                If (currentrow(5).Trim <> "" Or currentrow(6).Trim <> "" Or currentrow(7).Trim <> "" Or currentrow(8).Trim <> "") Then
                    add.requestForPayment.InvoiceCreator.nameAndAddress = New AMC71.ComprobanteAddendaRequestForPaymentInvoiceCreatorNameAndAddress()
                    If (currentrow(5).Trim <> "") Then
                        If (currentrow(5).Trim.Length > 35) Then
                            add.requestForPayment.InvoiceCreator.nameAndAddress.name = currentrow(5).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.InvoiceCreator.nameAndAddress.name = currentrow(5).Trim
                        End If
                    End If
                    If (currentrow(6).Trim <> "") Then
                        If (currentrow(6).Trim.Length > 35) Then
                            add.requestForPayment.InvoiceCreator.nameAndAddress.streetAddressOne = currentrow(6).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.InvoiceCreator.nameAndAddress.streetAddressOne = currentrow(6).Trim
                        End If
                    End If
                    If (currentrow(7).Trim <> "") Then
                        If (currentrow(7).Trim.Length > 35) Then
                            add.requestForPayment.InvoiceCreator.nameAndAddress.city = currentrow(7).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.InvoiceCreator.nameAndAddress.city = currentrow(7).Trim
                        End If
                    End If
                    If (currentrow(8).Trim <> "") Then
                        If (currentrow(8).Trim.Length > 9) Then
                            add.requestForPayment.InvoiceCreator.nameAndAddress.postalCode = currentrow(8).Trim.Substring(0, 9)
                        Else
                            add.requestForPayment.InvoiceCreator.nameAndAddress.postalCode = currentrow(8).Trim
                        End If
                    End If
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección INVOICECREATOR", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaCustoms(ByVal currentrow As String(), _
                                      ByRef Resp As List(Of RespuestaPremium), _
                                      ByRef add As AMC71.ComprobanteAddenda)
        Try
            'Llenamos Customs

            If (currentrow.Length = 7) Then
                If (add.requestForPayment.Customs Is Nothing) Then
                    add.requestForPayment.Customs = New AMC71.ComprobanteAddendaRequestForPaymentCustoms() {New AMC71.ComprobanteAddendaRequestForPaymentCustoms()}
                    ReDim add.requestForPayment.Customs(0)
                    If (currentrow(2).Trim <> "") Then
                        If (currentrow(2).Trim.Length <> 13) Then
                            ValidaCFDi.AgregaRespuesta("12", 3, "El dato gln de la seccion customs tiene una longitud incorrecta.", Resp)
                        Else
                            add.requestForPayment.Customs(0).gln = currentrow(2).Trim
                        End If
                    End If
                    If (currentrow(3).Trim <> "") Then
                        add.requestForPayment.Customs(0).alternatePartyIdentification = New AMC71.ComprobanteAddendaRequestForPaymentCustomsAlternatePartyIdentification()
                        If (currentrow(3).Trim.Length > 35) Then
                            add.requestForPayment.Customs(0).alternatePartyIdentification.Value = currentrow(3).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.Customs(0).alternatePartyIdentification.Value = currentrow(3).Trim
                        End If
                        add.requestForPayment.Customs(0).alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentCustomsAlternatePartyIdentificationType.TN
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 4, "El dato alternatePartyIdentification de la seccion customs es requerido.", Resp)
                    End If
                    If (currentrow(4).Trim <> "") Then
                        add.requestForPayment.Customs(0).ReferenceDate = Convert.ToDateTime(currentrow(4).Trim)
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 5, "El dato ReferenceDate de la seccion customs es requerido.", Resp)
                    End If
                    If (currentrow(5).Trim <> "" Or currentrow(6).Trim <> "") Then
                        add.requestForPayment.Customs(0).nameAndAddress = New AMC71.ComprobanteAddendaRequestForPaymentCustomsNameAndAddress()
                        If (currentrow(5).Trim <> "") Then
                            If (currentrow(5).Trim.Length > 35) Then
                                add.requestForPayment.Customs(0).nameAndAddress.name = currentrow(5).Trim.Substring(0, 35)
                            Else
                                add.requestForPayment.Customs(0).nameAndAddress.name = currentrow(5).Trim
                            End If
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 6, "El dato Name de la seccion Customs es requerido.", Resp)
                        End If
                        If (currentrow(6).Trim <> "") Then
                            If (currentrow(6).Trim.Length > 35) Then
                                add.requestForPayment.Customs(0).nameAndAddress.city = currentrow(6).Trim.Substring(0, 35)
                            Else
                                add.requestForPayment.Customs(0).nameAndAddress.city = currentrow(6).Trim
                            End If
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 7, "El dato city de la seccion Customs es requerido.", Resp)
                        End If
                    End If
                Else
                    ReDim Preserve add.requestForPayment.Customs(add.requestForPayment.Customs.Length)
                    If (currentrow(2).Trim <> "") Then
                        If (currentrow(2).Trim.Length <> 13) Then
                            ValidaCFDi.AgregaRespuesta("12", 3, "El dato gln de la seccion customs tiene una longitud incorrecta.", Resp)
                        Else
                            add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).gln = currentrow(2).Trim
                        End If
                    End If
                    If (currentrow(3).Trim <> "") Then
                        add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).alternatePartyIdentification = New AMC71.ComprobanteAddendaRequestForPaymentCustomsAlternatePartyIdentification()
                        If (currentrow(3).Trim.Length > 35) Then
                            add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).alternatePartyIdentification.Value = currentrow(3).Trim.Substring(0, 35)
                        Else
                            add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).alternatePartyIdentification.Value = currentrow(3).Trim
                        End If
                        add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentCustomsAlternatePartyIdentificationType.TN
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 4, "El dato alternatePartyIdentification de la seccion customs es requerido.", Resp)
                    End If
                    If (currentrow(4).Trim <> "") Then
                        add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).ReferenceDate = Convert.ToDateTime(currentrow(4).Trim)
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 5, "El dato ReferenceDate de la seccion customs es requerido.", Resp)
                    End If
                    If (currentrow(5).Trim <> "" Or currentrow(6).Trim <> "") Then
                        add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).nameAndAddress = New AMC71.ComprobanteAddendaRequestForPaymentCustomsNameAndAddress()
                        If (currentrow(5).Trim <> "") Then
                            If (currentrow(5).Trim.Length > 35) Then
                                add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).nameAndAddress.name = currentrow(5).Trim.Substring(0, 35)
                            Else
                                add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).nameAndAddress.name = currentrow(5).Trim
                            End If
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 6, "El dato Name de la seccion Customs es requerido.", Resp)
                        End If
                        If (currentrow(6).Trim <> "") Then
                            If (currentrow(6).Trim.Length > 35) Then
                                add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).nameAndAddress.city = currentrow(6).Trim.Substring(0, 35)
                            Else
                                add.requestForPayment.Customs(add.requestForPayment.Customs.Length - 1).nameAndAddress.city = currentrow(6).Trim
                            End If
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 7, "El dato city de la seccion Customs es requerido.", Resp)
                        End If
                    End If
                End If
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección CUSTOMS", Resp)
            End If

            Return True

        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaCurrency(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium), _
                                    ByRef add As AMC71.ComprobanteAddenda, ByVal moneda As String, ByVal tipoCambio As String)
        Try
            If (currentrow.Length = 3) Then
                add.requestForPayment.currency = New AMC71.ComprobanteAddendaRequestForPaymentCurrency() {New AMC71.ComprobanteAddendaRequestForPaymentCurrency()}
                ReDim add.requestForPayment.currency(0)
                add.requestForPayment.currency(0) = New AMC71.ComprobanteAddendaRequestForPaymentCurrency()
                Select Case moneda
                    Case "MXN"
                        add.requestForPayment.currency(0).currencyISOCode = AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyISOCode.MXN
                    Case "DLS"
                        add.requestForPayment.currency(0).currencyISOCode = AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyISOCode.USD
                    Case "EUR"
                        add.requestForPayment.currency(0).currencyISOCode = AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyISOCode.XEU
                End Select
                If (currentrow(2).Trim <> "") Then
                    add.requestForPayment.currency(0).currencyFunction = New AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyFunction() {New AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyFunction()}
                    ReDim add.requestForPayment.currency(0).currencyFunction(0)
                    Select Case currentrow(2).Trim
                        Case "BILLING_CURRENCY"
                            add.requestForPayment.currency(0).currencyFunction(0) = AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyFunction.BILLING_CURRENCY
                        Case "PRICE_CURRENCY"
                            add.requestForPayment.currency(0).currencyFunction(0) = AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyFunction.PRICE_CURRENCY
                        Case "PAYMENT_CURRENCY"
                            add.requestForPayment.currency(0).currencyFunction(0) = AMC71.ComprobanteAddendaRequestForPaymentCurrencyCurrencyFunction.PAYMENT_CURRENCY
                    End Select
                Else
                    ValidaCFDi.AgregaRespuesta("12", 3, "El dato currencyFunction de la seccion Currency es requerido.", Resp)
                    Return False
                End If
                add.requestForPayment.currency(0).rateOfChange = tipoCambio
                add.requestForPayment.currency(0).rateOfChangeSpecified = True
                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección CURRENCY", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaPaymentTerms(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium), _
                                    ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 10) Then
                add.requestForPayment.paymentTerms = New AMC71.ComprobanteAddendaRequestForPaymentPaymentTerms()
                If (currentrow(2).Trim <> "") Then
                    Select Case currentrow(2).Trim
                        Case "DATE_OF_INVOICE"
                            add.requestForPayment.paymentTerms.paymentTermsEvent = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsPaymentTermsEvent.DATE_OF_INVOICE
                            add.requestForPayment.paymentTerms.paymentTermsEventSpecified = True
                        Case "EFFECTIVE_DATE"
                            add.requestForPayment.paymentTerms.paymentTermsEvent = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsPaymentTermsEvent.EFFECTIVE_DATE
                            add.requestForPayment.paymentTerms.paymentTermsEventSpecified = True
                        Case Else
                            ValidaCFDi.AgregaRespuesta("12", 3, "El dato paymentTermsEvent de la seccion PAYMENTTERMS tiene un valor incorrecto.", Resp)
                    End Select
                End If
                If (currentrow(3).Trim <> "") Then
                    add.requestForPayment.paymentTerms.PaymentTermsRelationTime = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsPaymentTermsRelationTime.REFERENCE_AFTER
                    add.requestForPayment.paymentTerms.PaymentTermsRelationTimeSpecified = True
                End If
                add.requestForPayment.paymentTerms.netPayment = New AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPayment()
                If (currentrow(5).Trim = "") Then
                    ValidaCFDi.AgregaRespuesta("12", 6, "Debe indicar el dato netPaymentTermsType (5) de la seccion PAYMENTTERMS .", Resp)
                Else
                    add.requestForPayment.paymentTerms.netPayment.netPaymentTermsType = New AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentNetPaymentTermsType()
                    Select Case currentrow(5).Trim.ToUpper
                        Case "BASIC_NET"
                            add.requestForPayment.paymentTerms.netPayment.netPaymentTermsType = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentNetPaymentTermsType.BASIC_NET
                            add.requestForPayment.paymentTerms.netPayment.netPaymentTermsTypeSpecified = True
                        Case "END_OF_MONTH"
                            add.requestForPayment.paymentTerms.netPayment.netPaymentTermsType = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentNetPaymentTermsType.END_OF_MONTH
                            add.requestForPayment.paymentTerms.netPayment.netPaymentTermsTypeSpecified = True
                        Case "BASIC_DISCOUNT_OFFERED"
                            add.requestForPayment.paymentTerms.netPayment.netPaymentTermsType = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentNetPaymentTermsType.BASIC_DISCOUNT_OFFERED
                            add.requestForPayment.paymentTerms.netPayment.netPaymentTermsTypeSpecified = True
                        Case Else
                            ValidaCFDi.AgregaRespuesta("12", 6, "El dato netPaymentTermsType de la seccion PAYMENTTERMS debe tener un valor correcto", Resp)
                    End Select
                End If
                If (currentrow(6).Trim <> "" Or currentrow(7).Trim <> "") Then
                    add.requestForPayment.paymentTerms.netPayment.paymentTimePeriod = New AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentPaymentTimePeriod()
                    add.requestForPayment.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue = New AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDue()
                    add.requestForPayment.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.timePeriod = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsNetPaymentPaymentTimePeriodTimePeriodDueTimePeriod.DAYS
                    If (currentrow(7).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 8, "Debe indicar el dato (7) value de la seccion PAYMENTTERMS del complemento detallista.", Resp)
                    Else
                        If (currentrow(7).Trim.Length > 5) Then
                            ValidaCFDi.AgregaRespuesta("12", 8, "El dato Value timePeriodDue(7) de la seccion PAYMENTTERMS debe ser de longitud no mayor a 5 caracteres.", Resp)
                        End If
                        add.requestForPayment.paymentTerms.netPayment.paymentTimePeriod.timePeriodDue.value = currentrow(7).Trim
                    End If
                End If
                If (currentrow(8).Trim <> "" Or currentrow(9).Trim <> "") Then
                    add.requestForPayment.paymentTerms.discountPayment = New AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsDiscountPayment()
                    If (currentrow(8).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 9, "Debe indicar el dato discountType de la seccion PAYMENTTERMS.", Resp)
                    Else
                        Select Case currentrow(8).Trim.ToUpper
                            Case "ALLOWANCE_BY_PAYMENT_ON_TIME"
                                add.requestForPayment.paymentTerms.discountPayment.discountType = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsDiscountPaymentDiscountType.ALLOWANCE_BY_PAYMENT_ON_TIME
                            Case "SANCTION"
                                add.requestForPayment.paymentTerms.discountPayment.discountType = AMC71.ComprobanteAddendaRequestForPaymentPaymentTermsDiscountPaymentDiscountType.SANCTION
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 9, "Debe indicar un valor correcto en el dato discountType (8).", Resp)
                        End Select
                    End If
                    If (currentrow(9).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 10, "Debe indicar el dato percentage (9) de la seccion PAYMENTTERMS.", Resp)
                    Else
                        If (currentrow(9).Trim.Length > 5) Then
                            ValidaCFDi.AgregaRespuesta("12", 10, "El dato percentage(9) de la seccion PAYMENTTERMS debe ser de longitud no mayor a 5 caracteres.", Resp)
                        End If
                        add.requestForPayment.paymentTerms.discountPayment.percentage = currentrow(9).Trim
                    End If
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección PAYMENTTERMS", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaAllowanceCharge(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium), _
                                    ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 8) Then
                If (add.requestForPayment.allowanceCharge Is Nothing) Then
                    add.requestForPayment.allowanceCharge = New AMC71.ComprobanteAddendaRequestForPaymentAllowanceCharge() {New AMC71.ComprobanteAddendaRequestForPaymentAllowanceCharge()}
                    add.requestForPayment.allowanceCharge(0) = New AMC71.ComprobanteAddendaRequestForPaymentAllowanceCharge()
                    If (currentrow(2).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato allowanceChargeType (2) de la seccion ALLOWANCECHARGE.", Resp)
                    Else
                        Select Case currentrow(2).Trim.ToUpper
                            Case "ALLOWANCE_GLOBAL"
                                add.requestForPayment.allowanceCharge(0).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeAllowanceChargeType.ALLOWANCE_GLOBAL
                            Case "CHARGE_GLOBAL"
                                add.requestForPayment.allowanceCharge(0).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeAllowanceChargeType.CHARGE_GLOBAL
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar un valor correcto en el dato allowanceChargeType (2) de la seccion ALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    If (currentrow(3).Trim <> "") Then
                        Select Case currentrow(3).Trim.ToUpper
                            Case "BILL_BACK"
                                add.requestForPayment.allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSettlementType.BILL_BACK
                            Case "OFF_INVOICE"
                                add.requestForPayment.allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSettlementType.OFF_INVOICE
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar un valor correcto en el dato sttlementType (3) de la seccion ALLOWANCECHARGE.", Resp)
                        End Select
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar el dato settlementType de la seccion ALLOWANCECHARGE.", Resp)
                    End If
                    If (currentrow(4).Trim <> "") Then
                        If (currentrow(4).Trim.Length > 15) Then
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato sequenceNumber(4) de la seccion ALLOWANCECHARGE debe ser de longitud no mayor a 15 caracteres.", Resp)
                        End If
                        add.requestForPayment.allowanceCharge(0).sequenceNumber = currentrow(5).Trim
                    End If
                    If (currentrow(5).Trim <> "") Then
                        Select Case currentrow(5).Trim.ToUpper
                            Case "AA"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.AA
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ABZ"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ABZ
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ADS"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ADS
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ADT"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ADT
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ADO"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ADO
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "AJ"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.AJ
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "CAC"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.CAC
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "COD"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.COD
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "DA"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.DA
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "DI"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.DI
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "EAA"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.EAA
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "EAB"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.EAB
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FA"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FA
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FC"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FC
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FG"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FG
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FI"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FI
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "HD"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.HD
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "QD"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.QD
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "PAD"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.PAD
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "PI"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.PI
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "QD"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.QD
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "RAA"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.RAA
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "SAB"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.SAB
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TAE"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TAE
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TD"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TD
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TS"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TS
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TX"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TX
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TZ"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TZ
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "UM"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.UM
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "VAB"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.VAB
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ZZZ"
                                add.requestForPayment.allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ZZZ
                                add.requestForPayment.allowanceCharge(0).specialServicesTypeSpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 6, "Indique un valor correcto en el campo specialServicesType (5) de la seccion ALLOWANCECHARGE.", Resp)
                        End Select
                    End If


                    add.requestForPayment.allowanceCharge(0).monetaryAmountOrPercentage = New AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeMonetaryAmountOrPercentage()
                    If (currentrow(6).Trim <> "" Or currentrow(7).Trim <> "") Then
                        add.requestForPayment.allowanceCharge(0).monetaryAmountOrPercentage.rate = New AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeMonetaryAmountOrPercentageRate()
                        add.requestForPayment.allowanceCharge(0).monetaryAmountOrPercentage.rate.base = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeMonetaryAmountOrPercentageRateBase.INVOICE_VALUE
                        If (currentrow(7).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 8, "Debe indicar el dato percentage de la seccion ALLOWANCECHARGE.", Resp)
                        Else
                            Try
                                add.requestForPayment.allowanceCharge(0).monetaryAmountOrPercentage.rate.percentage = currentrow(7).Trim
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 8, "No se pudo realizar la conversion a decimal del dato percentage de la seccion ALLOWANCECHARGE", Resp)
                            End Try
                        End If
                    End If
                Else
                    ReDim Preserve add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length)
                    If (currentrow(2).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato allowanceChargeType (2) de la seccion ALLOWANCECHARGE.", Resp)
                    Else
                        Select Case currentrow(2).Trim.ToUpper
                            Case "ALLOWANCE_GLOBAL"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeAllowanceChargeType.ALLOWANCE_GLOBAL
                            Case "CHARGE_GLOBAL"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeAllowanceChargeType.CHARGE_GLOBAL
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar un valor correcto en el dato allowanceChargeType (2) de la seccion ALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    If (currentrow(3).Trim <> "") Then
                        Select Case currentrow(3).Trim.ToUpper
                            Case "BILL_BACK"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).settlementType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSettlementType.BILL_BACK
                            Case "OFF_INVOICE"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).settlementType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSettlementType.OFF_INVOICE
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar un valor correcto en el dato sttlementType (3) de la seccion ALLOWANCECHARGE.", Resp)
                        End Select
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar el dato settlementType de la seccion ALLOWANCECHARGE.", Resp)
                    End If
                    If (currentrow(4).Trim <> "") Then
                        If (currentrow(4).Trim.Length > 15) Then
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato sequenceNumber(4) de la seccion ALLOWANCECHARGE debe ser de longitud no mayor a 15 caracteres.", Resp)
                        End If
                        add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).sequenceNumber = currentrow(5).Trim
                    End If
                    If (currentrow(5).Trim <> "") Then
                        Select Case currentrow(5).Trim.ToUpper
                            Case "AA"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.AA
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ABZ"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ABZ
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ADS"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ADS
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ADT"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ADT
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ADO"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ADO
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "AJ"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.AJ
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "CAC"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.CAC
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "COD"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.COD
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "DA"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.DA
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "DI"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.DI
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "EAA"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.EAA
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "EAB"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.EAB
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FA"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FA
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FC"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FC
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FG"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FG
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FI"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.FI
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "HD"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.HD
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "QD"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.QD
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "PAD"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.PAD
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "PI"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.PI
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "QD"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.QD
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "RAA"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.RAA
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "SAB"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.SAB
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TAE"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TAE
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TD"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TD
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TS"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TS
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TX"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TX
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TZ"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.TZ
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "UM"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.UM
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "VAB"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.VAB
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ZZZ"
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeSpecialServicesType.ZZZ
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 6, "Indique un valor correcto en el campo specialServicesType (5) de la seccion ALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).monetaryAmountOrPercentage = New AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeMonetaryAmountOrPercentage()
                    If (currentrow(6).Trim <> "" Or currentrow(7).Trim <> "") Then
                        add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).monetaryAmountOrPercentage.rate = New AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeMonetaryAmountOrPercentageRate()
                        add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).monetaryAmountOrPercentage.rate.base = AMC71.ComprobanteAddendaRequestForPaymentAllowanceChargeMonetaryAmountOrPercentageRateBase.INVOICE_VALUE
                        If (currentrow(7).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 8, "Debe indicar el dato percentage de la seccion ALLOWANCECHARGE.", Resp)
                        Else
                            Try
                                add.requestForPayment.allowanceCharge(add.requestForPayment.allowanceCharge.Length - 1).monetaryAmountOrPercentage.rate.percentage = currentrow(7).Trim
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 8, "No se pudo realizar la conversion a decimal del dato percentage de la seccion ALLOWANCECHARGE", Resp)
                            End Try
                        End If
                    End If
                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección ALLOWANCECHARGE", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaLineItem(ByVal currentrow As String(), ByVal comprobante As Comprobante, ByRef Resp As List(Of RespuestaPremium), _
                                    ByRef add As AMC71.ComprobanteAddenda, ByVal i As Integer, ByVal currentCompr As List(Of String()))
        Try
            If (currentrow.Length = 38 Or currentrow.Length = 48) Then
                If (add.requestForPayment.lineItem Is Nothing) Then
                    add.requestForPayment.lineItem = New AMC71.ComprobanteAddendaRequestForPaymentLineItem() {New AMC71.ComprobanteAddendaRequestForPaymentLineItem()}
                    add.requestForPayment.lineItem(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItem()
                    If (currentrow(2).Trim <> "") Then
                        add.requestForPayment.lineItem(0).type = "SimpleInvoiceLineItemType"
                    End If
                    If (currentrow(3).Trim <> "") Then
                        add.requestForPayment.lineItem(0).number = currentrow(3).Trim
                    End If
                    If (currentrow(4).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 5, "Debe indicar el dato gtin(4) de la seccion LineItem.", Resp)
                    Else
                        add.requestForPayment.lineItem(0).tradeItemIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemIdentification()
                        If (currentrow(4).Trim.Length > 14) Then
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato gtin (4) de la seccion LINEITEM no debe ser mayor a 14 caracteres.", Resp)
                        End If
                        add.requestForPayment.lineItem(0).tradeItemIdentification.gtin = currentrow(4).Trim
                    End If
                    If (currentrow(5).Trim <> "" Or currentrow(6).Trim <> "") Then
                        add.requestForPayment.lineItem(0).alternateTradeItemIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentification() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentification()}
                        If (currentrow(5).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 6, "Debe indicar el dato type(5) de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(5).Trim.ToUpper
                                Case "BUYER_ASSIGNED"
                                    add.requestForPayment.lineItem(0).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.BUYER_ASSIGNED
                                Case "SUPPLIER_ASSIGNED"
                                    add.requestForPayment.lineItem(0).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.SUPPLIER_ASSIGNED
                                Case "SERIAL_NUMBER"
                                    add.requestForPayment.lineItem(0).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.SERIAL_NUMBER
                                Case "GLOBAL_TRADE_Item_IDENTIFICATION"
                                    add.requestForPayment.lineItem(0).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.GLOBAL_TRADE_ITEM_IDENTIFICATION
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 6, "Debe indicar un valor correcto en el dato type(5) de la seccion LINETEM.", Resp)
                            End Select
                        End If
                        If (currentrow(6).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 7, "Debe indicar el dato valor(6) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(0).alternateTradeItemIdentification(0).Text = New String() {1}
                            add.requestForPayment.lineItem(0).alternateTradeItemIdentification(0).Text(0) = currentrow(6).Trim
                        End If
                    End If
                    If (currentrow(7).Trim <> "") Then
                        add.requestForPayment.lineItem(0).tradeItemDescriptionInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemDescriptionInformation()
                        Select Case currentrow(7).Trim.ToUpper
                            Case "ES"
                                add.requestForPayment.lineItem(0).tradeItemDescriptionInformation.language = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemDescriptionInformationLanguage.ES
                                add.requestForPayment.lineItem(0).tradeItemDescriptionInformation.languageSpecified = True
                            Case "EN"
                                add.requestForPayment.lineItem(0).tradeItemDescriptionInformation.language = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemDescriptionInformationLanguage.EN
                                add.requestForPayment.lineItem(0).tradeItemDescriptionInformation.languageSpecified = True
                        End Select
                    End If
                    If (comprobante.Conceptos(i).descripcion.Length > 35) Then
                        ValidaCFDi.AgregaRespuesta("12", 0, "El dato descripcion del producto no puede tener una longitud mayor a 35 caracteres.", Resp)
                    End If
                    add.requestForPayment.lineItem(0).tradeItemDescriptionInformation.longText = comprobante.Conceptos(i).descripcion
                    add.requestForPayment.lineItem(0).invoicedQuantity = New AMC71.ComprobanteAddendaRequestForPaymentLineItemInvoicedQuantity()
                    add.requestForPayment.lineItem(0).invoicedQuantity.unitOfMeasure = comprobante.Conceptos(i).unidad
                    add.requestForPayment.lineItem(0).invoicedQuantity.Text = New String() {1}
                    add.requestForPayment.lineItem(0).invoicedQuantity.Text(0) = comprobante.Conceptos(i).cantidad.ToString()
                    If (currentrow(8).Trim <> "" Or currentrow(9).Trim <> "") Then
                        add.requestForPayment.lineItem(0).aditionalQuantity = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantity() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantity()}
                        add.requestForPayment.lineItem(0).aditionalQuantity(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantity()
                        If (currentrow(8).Trim <> "") Then
                            add.requestForPayment.lineItem(0).aditionalQuantity(0).Text = New String() {1}
                            add.requestForPayment.lineItem(0).aditionalQuantity(0).Text(0) = currentrow(8).Trim
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 9, "Debe indicar el dato aditionalQuantity de la seccion LINEITEM.", Resp)
                        End If
                        If (currentrow(9).Trim <> "") Then
                            Select Case currentrow(9).Trim
                                Case "NUM_CONSUMER_UNITS"
                                    add.requestForPayment.lineItem(0).aditionalQuantity(0).QuantityType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantityQuantityType.NUM_CONSUMER_UNITS
                                Case "FREE_GOODS"
                                    add.requestForPayment.lineItem(0).aditionalQuantity(0).QuantityType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantityQuantityType.FREE_GOODS
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 10, "El dato type aditionalQuantity de la seccion LINEITEM tiene un valor incorrecto.", Resp)
                            End Select
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 10, "Debe indicar el dato type aditionalQuantity de la seccion LINEITEM.", Resp)
                        End If
                    End If
                    add.requestForPayment.lineItem(0).grossPrice = New AMC71.ComprobanteAddendaRequestForPaymentLineItemGrossPrice()
                    add.requestForPayment.lineItem(0).grossPrice.Amount = comprobante.Conceptos(i).valorUnitario
                    If (currentrow(10).Trim <> "") Then
                        add.requestForPayment.lineItem(0).netPrice = New AMC71.ComprobanteAddendaRequestForPaymentLineItemNetPrice()
                        Try
                            add.requestForPayment.lineItem(0).netPrice.Amount = CDec(currentrow(10).Trim)
                        Catch ex As Exception
                            ValidaCFDi.AgregaRespuesta("12", 11, "No se puede realizar la conversion a decimal del dato netPrice LINEITEM" & ex.Message, Resp)
                        End Try
                    End If
                    If (currentrow(11).Trim <> "" Or currentrow(12).Trim <> "") Then
                        add.requestForPayment.lineItem(0).AdditionalInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAdditionalInformation()
                        add.requestForPayment.lineItem(0).AdditionalInformation.referenceIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAdditionalInformationReferenceIdentification()
                        add.requestForPayment.lineItem(0).AdditionalInformation.referenceIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAdditionalInformationReferenceIdentificationType.ON
                        If (currentrow(12).Trim <> "") Then
                            add.requestForPayment.lineItem(0).AdditionalInformation.referenceIdentification.Value = currentrow(12).Trim
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 13, "Debe indicar el dato ReferenceIdentification de la seccion LINEITEM", Resp)
                        End If
                    End If
                    If (currentrow(13).Trim <> "" Or currentrow(14).Trim <> "" Or currentrow(15).Trim <> "" Or currentrow(16).Trim <> "" Or currentrow(17).Trim <> "") Then
                        add.requestForPayment.lineItem(0).Customs = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustoms() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustoms()}
                        add.requestForPayment.lineItem(0).Customs(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustoms()
                        If (currentrow(13).Trim <> "") Then
                            If (currentrow(13).Trim.Length <> 13) Then
                                ValidaCFDi.AgregaRespuesta("12", 14, "El dato Gln(13) customs de la seccion LINEITEM no debe tener una longitud mayor a 13 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(0).Customs(0).gln = currentrow(13).Trim
                        End If
                        If (currentrow(14).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 15, "Debe indicar el dato TypeAlternatePartyIdentificationCustom de la seccion LINEITEM", Resp)
                        Else
                            add.requestForPayment.lineItem(0).Customs(0).alternatePartyIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustomsAlternatePartyIdentification()
                            add.requestForPayment.lineItem(0).Customs(0).alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemCustomsAlternatePartyIdentificationType.TN
                        End If
                        If (currentrow(15).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 16, "Debe indicar el dato AlternatePartyIdentificationCustom de la seccion LINEITEM", Resp)
                        Else
                            add.requestForPayment.lineItem(0).Customs(0).alternatePartyIdentification.Value = currentrow(15).Trim
                        End If
                        If (currentrow(16).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 17, "Debe indicar el dato referenceDate custom (16) de la seccion LINEITEM.", Resp)
                        Else
                            Try
                                add.requestForPayment.lineItem(0).Customs(0).ReferenceDate = CDate(currentrow(16).Trim)
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 17, "No se pudo convertir el dato ReferenceDate Custom (16).", Resp)
                            End Try
                        End If
                        If (currentrow(17).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 18, "Debe indicar el dato name custom(17) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(0).Customs(0).nameAndAddress = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustomsNameAndAddress()
                            If (currentrow(17).Trim.Length > 35) Then
                                ValidaCFDi.AgregaRespuesta("12", 18, "El dato name(17) customs de la seccion LINEITEM no puede tener una longitud mayor a 35 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(0).Customs(0).nameAndAddress.name = currentrow(17).Trim
                        End If
                    End If
                    If (currentrow(18).Trim <> "" Or currentrow(19).Trim <> "") Then
                        add.requestForPayment.lineItem(0).LogisticUnits = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnits()
                        add.requestForPayment.lineItem(0).LogisticUnits.serialShippingContainerCode = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnitsSerialShippingContainerCode()
                        If (currentrow(18).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 19, "Debe indicar el dato serialChippingContainerCode(18) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(0).LogisticUnits.serialShippingContainerCode.Value = currentrow(18).Trim
                        End If
                        If (currentrow(19).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 20, "Debe indicar el dato type SerialChippingContainerCode de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(19).Trim.ToUpper
                                Case "BJ"
                                    add.requestForPayment.lineItem(0).LogisticUnits.serialShippingContainerCode.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnitsSerialShippingContainerCodeType.BJ
                                Case "SRV"
                                    add.requestForPayment.lineItem(0).LogisticUnits.serialShippingContainerCode.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnitsSerialShippingContainerCodeType.SRV
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 20, "Debe indicar un valor correcto en el dato serialShippingContainerCode type (19) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                    End If
                    If (currentrow(20).Trim <> "" Or currentrow(21).Trim <> "" Or currentrow(22).Trim <> "" Or currentrow(23).Trim <> "") Then
                        add.requestForPayment.lineItem(0).palletInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformation()
                        If (currentrow(20).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 21, "Debe indicar el dato palletQuantity (20) de la seccion LINEITEM.", Resp)
                        Else
                            If (currentrow(20).Trim.Length > 15) Then
                                ValidaCFDi.AgregaRespuesta("12", 21, "El dato palletQuantity (20) de la seccion LINEITEM no puede tener una longitud mayor a 15 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(0).palletInformation.palletQuantity = currentrow(20).Trim
                        End If
                        add.requestForPayment.lineItem(0).palletInformation.description = New AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescription()
                        If (currentrow(21).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 22, "Debe indciar el dato typeDescription (21) de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(21).Trim.ToUpper
                                Case "EXCHANGE_PALLETS"
                                    add.requestForPayment.lineItem(0).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.EXCHANGE_PALLETS
                                Case "RETURN_PALLETS"
                                    add.requestForPayment.lineItem(0).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.RETURN_PALLETS
                                Case "PALLET_80X100"
                                    add.requestForPayment.lineItem(0).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.PALLET_80x100
                                Case "CASE"
                                    add.requestForPayment.lineItem(0).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.CASE
                                Case "BOX"
                                    add.requestForPayment.lineItem(0).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.BOX
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 22, "Debe indicar un valor correcto en el dato typeDescription (21) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                        If (currentrow(22).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 23, "Debe indicar el dato description(22) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(0).palletInformation.description.Text = New String() {1}
                            add.requestForPayment.lineItem(0).palletInformation.description.Text(0) = currentrow(22).Trim
                        End If
                        If (currentrow(23).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 24, "Debe indicar el dato methodOfPayment (23) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(0).palletInformation.transport = New AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationTransport()
                            Select Case currentrow(23).Trim.ToUpper
                                Case "PREPAID_BY_SELLER"
                                    add.requestForPayment.lineItem(0).palletInformation.transport.methodOfPayment = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationTransportMethodOfPayment.PREPAID_BY_SELLER
                                Case "PAID_BY_BUYER"
                                    add.requestForPayment.lineItem(0).palletInformation.transport.methodOfPayment = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationTransportMethodOfPayment.PAID_BY_BUYER
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 24, "Debe indicar un valor correcto en el dato methodOfPayment (23) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                    End If
                    If (currentrow(24).Trim <> "") Then
                        add.requestForPayment.lineItem(0).extendedAttributes = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLotNumber() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemLotNumber()}
                        add.requestForPayment.lineItem(0).extendedAttributes(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLotNumber()
                        add.requestForPayment.lineItem(0).extendedAttributes(0).Value = currentrow(24).Trim
                        If (currentrow(25).Trim <> "") Then
                            Try
                                add.requestForPayment.lineItem(0).extendedAttributes(0).productionDate = CDate(currentrow(25).Trim)
                                add.requestForPayment.lineItem(0).extendedAttributes(0).productionDateSpecified = True
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 26, "No se pudo realizar la conversion en fecha extendedAttributes ProductionDate LINEITEM.", Resp)
                            End Try
                        End If
                    End If
                    If (currentrow(26).Trim <> "" Or currentrow(27).Trim <> "" Or currentrow(28).Trim <> "" Or currentrow(29).Trim <> "" Or currentrow(30).Trim <> "" Or _
                       currentrow(31).Trim <> "") Then
                        add.requestForPayment.lineItem(0).allowanceCharge = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceCharge() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceCharge()}
                        add.requestForPayment.lineItem(0).allowanceCharge(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceCharge()
                        If (currentrow(26).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 27, "Debe indicar el dato AllowanceChargeType (26) en la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(26).Trim.ToUpper
                                Case "ALLOWANCE_GLOBAL"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeAllowanceChargeType.ALLOWANCE_GLOBAL
                                Case "CHARGE_GLOBAL"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeAllowanceChargeType.CHARGE_GLOBAL
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 27, "Debe indicar un valor correcto en el dato AllowanceChargeType (26) de la seccion LINEITEM. ", Resp)
                            End Select
                        End If
                        If (currentrow(27).Trim <> "") Then
                            add.requestForPayment.lineItem(0).allowanceCharge(0).settlementType = New Detallista.detallistaLineItemAllowanceChargeSettlementType()
                            Select Case currentrow(26).Trim.ToUpper
                                Case "OFF_INVOICE"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSettlementType.OFF_INVOICE
                                Case "CHARGE_TO_BE_PAID_BY_VENDOR"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSettlementType.CHARGE_TO_BE_PAID_BY_VENDOR
                                Case "CHARGE_TO_BE_PAID_BY_CUSTOMER"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSettlementType.CHARGE_TO_BE_PAID_BY_CUSTOMER
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 27, "Debe indicar un valor correcto en el dato settlementType (27) en la seccion LINEITEM.", Resp)
                            End Select
                        End If
                        If (currentrow(28).Trim <> "") Then
                            If (currentrow(28).Trim.Length > 15) Then
                                ValidaCFDi.AgregaRespuesta("12", 29, "El dato sequenceNumber (28) de la seccion LINEITEM no puede tener una longitud mayor a 15 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(0).allowanceCharge(0).sequenceNumber = currentrow(28).Trim
                        End If
                        If (currentrow(29).Trim <> "") Then
                            add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = New Detallista.detallistaLineItemAllowanceChargeSpecialServicesType()
                            Select Case currentrow(29).Trim.ToUpper
                                Case "AA"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.AA
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ADS"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ADS
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ADO"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ADO
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ABZ"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ABZ
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "DA"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.DA
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "EAA"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.EAA
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "PI"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.PI
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TAE"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TAE
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "SAB"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.SAB
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "RAA"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.RAA
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "PAD"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.PAD
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FG"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FG
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FA"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FA
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TD"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TD
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TS"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TS
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TX"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TX
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ZZZ"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ZZZ
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "VAB"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.VAB
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "UM"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.UM
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "DI"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.DI
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ADT"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ADT
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "AJ"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.AJ
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "CAC"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.CAC
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "COD"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.COD
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "EAB"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.EAB
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FC"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FC
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FI"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FI
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "HD"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.HD
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "QD"
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.QD
                                    add.requestForPayment.lineItem(0).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 30, "Debe indicar un valor correcto en el campo specialServicesType (28) de la seccion LINEITEM del complemento detallista.", Resp)
                            End Select
                        End If
                        If (currentrow(30).Trim <> "" Or currentrow(31).Trim <> "") Then
                            add.requestForPayment.lineItem(0).allowanceCharge(0).monetaryAmountOrPercentage = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeMonetaryAmountOrPercentage()
                            If (currentrow(30).Trim = "") Then
                                ValidaCFDi.AgregaRespuesta("12", 31, "Debe indicar el dato percentagePerUnit (30) de la seccion LINEITEM.", Resp)
                            Else
                                If (currentrow(30).Trim.Length > 5) Then
                                    ValidaCFDi.AgregaRespuesta("12", 31, "El dato percentagePerUnit (30) de la seccion LINEITEM no puede tener una longitud mayor a 5 caracteres.", Resp)
                                End If
                                add.requestForPayment.lineItem(0).allowanceCharge(0).monetaryAmountOrPercentage.percentagePerUnit = currentrow(30)
                            End If
                            If (currentrow(31).Trim = "") Then
                                ValidaCFDi.AgregaRespuesta("12", 32, "Debe indicar el dato amountPerUnit (31) de la seccion LINEITEM.", Resp)
                            Else
                                add.requestForPayment.lineItem(0).allowanceCharge(0).monetaryAmountOrPercentage.ratePerUnit = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeMonetaryAmountOrPercentageRatePerUnit()
                                If (currentrow(31).Trim.Length > 5) Then
                                    ValidaCFDi.AgregaRespuesta("12", 32, "El dato amountPerUnit (31) de la seccion LINEITEM no puede tener una longitud mayor a 5 caracteres.", Resp)
                                End If
                                add.requestForPayment.lineItem(0).allowanceCharge(0).monetaryAmountOrPercentage.ratePerUnit.amountPerUnit = currentrow(31)
                            End If
                        End If
                    End If
                    If (currentrow(32).Trim <> "" Or currentrow(33).Trim <> "" Or currentrow(34).Trim <> "" Or currentrow(35).Trim <> "" Or currentrow(36).Trim <> "") Then
                        add.requestForPayment.lineItem(0).tradeItemTaxInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()}
                        If (currentrow(32).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 33, "Debe indicar el dato taxTypeDescription (32) de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(32).Trim.ToUpper
                                Case "GST"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                Case "VAT"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                Case "LAC"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                Case "AAA"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                Case "ADD"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                Case "FRE"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                Case "LOC"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                Case "STT"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                Case "OTH"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                            End Select
                        End If
                        If (currentrow(33).Trim <> "") Then
                            If (currentrow(33).Trim.Length > 20) Then
                                ValidaCFDi.AgregaRespuesta("12", 34, "El dato referenceNumber (33) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).referenceNumber = currentrow(33).Trim
                        End If
                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                        If (currentrow(34).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 35, "Debe indicar el dato taxPercentage (34) de la seccion LINEITEM.", Resp)
                        Else
                            Try
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = CDec(currentrow(34).Trim)
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 35, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                            End Try
                        End If
                        If (currentrow(35).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 36, "Debe indicar el dato taxAmount (35) de la seccion LINEITEM.", Resp)
                        Else
                            Try
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = CDec(currentrow(35).Trim)
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 36, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                            End Try
                        End If
                        If (currentrow(36).Trim <> "") Then
                            Select Case currentrow(36).Trim.ToUpper
                                Case "TRANSFERIDO"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategorySpecified = True
                                Case "RETENIDO"
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategorySpecified = True
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 37, "Debe indicar un valor correcto en el dato taxcategory (36) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                    End If
                    add.requestForPayment.lineItem(0).totalLineAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTotalLineAmount()
                    add.requestForPayment.lineItem(0).totalLineAmount.grossAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTotalLineAmountGrossAmount()
                    add.requestForPayment.lineItem(0).totalLineAmount.grossAmount.Amount = comprobante.Conceptos(i).importe
                    add.requestForPayment.lineItem(0).totalLineAmount.netAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTotalLineAmountNetAmount()
                    Try
                        add.requestForPayment.lineItem(0).totalLineAmount.netAmount.Amount = CDec(currentrow(37).Trim)
                    Catch ex As Exception
                        ValidaCFDi.AgregaRespuesta("12", 38, "No se pudo realizar la conversion a decimal del dato NetAmount LineItem.", Resp)
                    End Try
                    If (currentrow.Length = 48) Then
                        If (currentrow(38).Trim <> "" Or currentrow(39).Trim <> "" Or currentrow(40).Trim <> "" Or currentrow(41).Trim <> "" Or currentrow(42).Trim <> "") Then
                            If (add.requestForPayment.lineItem(0).tradeItemTaxInformation Is Nothing) Then
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()}
                                If (currentrow(38).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 39, "Debe indicar el dato taxTypeDescription (38) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(38).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(39).Trim <> "") Then
                                    If (currentrow(39).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 40, "El dato referenceNumber (39) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).referenceNumber = currentrow(39).Trim
                                End If
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(40).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 41, "Debe indicar el dato taxPercentage (40) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = CDec(currentrow(40).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 41, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(41).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 42, "Debe indicar el dato taxAmount (41) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = CDec(currentrow(41).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 42, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(42).Trim <> "") Then
                                    Select Case currentrow(42).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 43, "Debe indicar un valor correcto en el dato taxcategory (42) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            Else
                                ReDim Preserve add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length)
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()
                                If (currentrow(38).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 39, "Debe indicar el dato taxTypeDescription (38) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(38).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(39).Trim <> "") Then
                                    If (currentrow(39).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 40, "El dato referenceNumber (39) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).referenceNumber = currentrow(39).Trim
                                End If
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(40).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 41, "Debe indicar el dato taxPercentage (40) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxPercentage = CDec(currentrow(40).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 41, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(41).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 42, "Debe indicar el dato taxAmount (41) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxAmount = CDec(currentrow(41).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 42, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(42).Trim <> "") Then
                                    Select Case currentrow(42).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 43, "Debe indicar un valor correcto en el dato taxcategory (42) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            End If
                        End If
                        If (currentrow(43).Trim <> "" Or currentrow(44).Trim <> "" Or currentrow(45).Trim <> "" Or currentrow(46).Trim <> "" Or currentrow(47).Trim <> "") Then
                            If (add.requestForPayment.lineItem(0).tradeItemTaxInformation Is Nothing) Then
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()}
                                If (currentrow(43).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 44, "Debe indicar el dato taxTypeDescription (43) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(43).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(44).Trim <> "") Then
                                    If (currentrow(44).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 45, "El dato referenceNumber (44) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).referenceNumber = currentrow(44).Trim
                                End If
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(45).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 46, "Debe indicar el dato taxPercentage (45) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = CDec(currentrow(45).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 46, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(46).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 47, "Debe indicar el dato taxAmount (46) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = CDec(currentrow(46).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 47, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(47).Trim <> "") Then
                                    Select Case currentrow(47).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 48, "Debe indicar un valor correcto en el dato taxcategory (47) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            Else
                                ReDim Preserve add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length)
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()
                                If (currentrow(43).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 44, "Debe indicar el dato taxTypeDescription (43) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(43).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(44).Trim <> "") Then
                                    If (currentrow(44).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 45, "El dato referenceNumber (44) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).referenceNumber = currentrow(44).Trim
                                End If
                                add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(45).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 46, "Debe indicar el dato taxPercentage (45) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxPercentage = CDec(currentrow(45).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 46, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(46).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 47, "Debe indicar el dato taxAmount (46) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxAmount = CDec(currentrow(46).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 47, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(47).Trim <> "") Then
                                    Select Case currentrow(47).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(0).tradeItemTaxInformation(add.requestForPayment.lineItem(0).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 48, "Debe indicar un valor correcto en el dato taxcategory (47) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            End If

                        End If
                    End If
                Else
                    ReDim Preserve add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length)
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentLineItem()
                    If (currentrow(2).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).type = "SimpleInvoiceLineItemType"
                    End If
                    If (currentrow(3).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).number = currentrow(3).Trim
                    End If
                    If (currentrow(4).Trim = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 5, "Debe indicar el dato gtin(4) de la seccion LineItem.", Resp)
                    Else
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemIdentification()
                        If (currentrow(4).Trim.Length > 14) Then
                            ValidaCFDi.AgregaRespuesta("12", 5, "El dato gtin (4) de la seccion LINEITEM no debe ser mayor a 14 caracteres.", Resp)
                        End If
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemIdentification.gtin = currentrow(4).Trim
                    End If
                    If (currentrow(5).Trim <> "" Or currentrow(6).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentification() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentification()}
                        If (currentrow(5).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 6, "Debe indicar el dato type(5) de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(5).Trim.ToUpper
                                Case "BUYER_ASSIGNED"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.BUYER_ASSIGNED
                                Case "SUPPLIER_ASSIGNED"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.SUPPLIER_ASSIGNED
                                Case "SERIAL_NUMBER"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.SERIAL_NUMBER
                                Case "GLOBAL_TRADE_Item_IDENTIFICATION"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification(0).type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAlternateTradeItemIdentificationType.GLOBAL_TRADE_ITEM_IDENTIFICATION
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 6, "Debe indicar un valor correcto en el dato type(5) de la seccion LINETEM.", Resp)
                            End Select
                        End If
                        If (currentrow(6).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 7, "Debe indicar el dato valor(6) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification(0).Text = New String() {1}
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).alternateTradeItemIdentification(0).Text(0) = currentrow(6).Trim
                        End If
                    End If
                    If (currentrow(7).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemDescriptionInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemDescriptionInformation()
                        Select Case currentrow(7).Trim.ToUpper
                            Case "ES"
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemDescriptionInformation.language = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemDescriptionInformationLanguage.ES
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemDescriptionInformation.languageSpecified = True
                            Case "EN"
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemDescriptionInformation.language = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemDescriptionInformationLanguage.EN
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemDescriptionInformation.languageSpecified = True
                        End Select
                    End If
                    If (comprobante.Conceptos(i).descripcion.Length > 35) Then
                        ValidaCFDi.AgregaRespuesta("12", 0, "El dato descripcion del producto no puede tener una longitud mayor a 35 caracteres.", Resp)
                    End If
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemDescriptionInformation.longText = comprobante.Conceptos(i).descripcion
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).invoicedQuantity = New AMC71.ComprobanteAddendaRequestForPaymentLineItemInvoicedQuantity()
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).invoicedQuantity.unitOfMeasure = comprobante.Conceptos(i).unidad
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).invoicedQuantity.Text = New String() {1}
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).invoicedQuantity.Text(0) = comprobante.Conceptos(i).cantidad.ToString()
                    If (currentrow(8).Trim <> "" Or currentrow(9).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).aditionalQuantity = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantity() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantity()}
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).aditionalQuantity(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantity()
                        If (currentrow(8).Trim <> "") Then
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).aditionalQuantity(0).Text = New String() {1}
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).aditionalQuantity(0).Text(0) = currentrow(8).Trim
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 9, "Debe indicar el dato aditionalQuantity de la seccion LINEITEM.", Resp)
                        End If
                        If (currentrow(9).Trim <> "") Then
                            Select Case currentrow(9).Trim
                                Case "NUM_CONSUMER_UNITS"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).aditionalQuantity(0).QuantityType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantityQuantityType.NUM_CONSUMER_UNITS
                                Case "FREE_GOODS"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).aditionalQuantity(0).QuantityType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAditionalQuantityQuantityType.FREE_GOODS
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 10, "El dato type aditionalQuantity de la seccion LINEITEM tiene un valor incorrecto.", Resp)
                            End Select
                        Else
                            ValidaCFDi.AgregaRespuesta("12", 10, "Debe indicar el dato type aditionalQuantity de la seccion LINEITEM.", Resp)
                        End If
                    End If
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).grossPrice = New AMC71.ComprobanteAddendaRequestForPaymentLineItemGrossPrice()
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).grossPrice.Amount = comprobante.Conceptos(i).valorUnitario
                    If (currentrow(10).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).netPrice = New AMC71.ComprobanteAddendaRequestForPaymentLineItemNetPrice()
                        Try
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).netPrice.Amount = CDec(currentrow(10).Trim)
                        Catch ex As Exception
                            ValidaCFDi.AgregaRespuesta("12", 11, "No se puede realizar la conversion a decimal del dato netPrice LINEITEM" & ex.Message, Resp)
                        End Try
                    End If
                    If (currentrow(11).Trim <> "" Or currentrow(12).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).AdditionalInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAdditionalInformation()
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).AdditionalInformation.referenceIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAdditionalInformationReferenceIdentification()
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).AdditionalInformation.referenceIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemAdditionalInformationReferenceIdentificationType.ON
                        If (currentrow(12).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 13, "El dato ReferenceIdentification", Resp)
                        End If
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).AdditionalInformation.referenceIdentification.Value = currentrow(12).Trim
                    End If
                    If (currentrow(13).Trim <> "" Or currentrow(14).Trim <> "" Or currentrow(15).Trim <> "" Or currentrow(16).Trim <> "" Or currentrow(17).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustoms() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustoms()}
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustoms()
                        If (currentrow(13).Trim <> "") Then
                            If (currentrow(13).Trim.Length <> 13) Then
                                ValidaCFDi.AgregaRespuesta("12", 14, "El dato Gln(13) customs de la seccion LINEITEM no debe tener una longitud mayor a 13 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).gln = currentrow(13).Trim
                        End If
                        If (currentrow(14).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 15, "Debe indicar el dato TypeAlternatePartyIdentificationCustom de la seccion LINEITEM", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).alternatePartyIdentification = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustomsAlternatePartyIdentification()
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).alternatePartyIdentification.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemCustomsAlternatePartyIdentificationType.TN
                        End If
                        If (currentrow(15).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 16, "Debe indicar el dato AlternatePartyIdentificationCustom de la seccion LINEITEM", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).alternatePartyIdentification.Value = currentrow(15).Trim
                        End If
                        If (currentrow(16).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 17, "Debe indicar el dato referenceDate custom (16) de la seccion LINEITEM.", Resp)
                        Else
                            Try
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).ReferenceDate = CDate(currentrow(16).Trim)
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 17, "No se pudo convertir el dato ReferenceDate Custom (16).", Resp)
                            End Try
                        End If
                        If (currentrow(17).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 18, "Debe indicar el dato name custom(17) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).nameAndAddress = New AMC71.ComprobanteAddendaRequestForPaymentLineItemCustomsNameAndAddress()
                            If (currentrow(17).Trim.Length > 35) Then
                                ValidaCFDi.AgregaRespuesta("12", 18, "El dato name(17) customs de la seccion LINEITEM no puede tener una longitud mayor a 35 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).Customs(0).nameAndAddress.name = currentrow(17).Trim
                        End If
                    End If
                    If (currentrow(18).Trim <> "" Or currentrow(19).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).LogisticUnits = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnits()
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).LogisticUnits.serialShippingContainerCode = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnitsSerialShippingContainerCode()
                        If (currentrow(18).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 19, "Debe indicar el dato serialChippingContainerCode(18) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).LogisticUnits.serialShippingContainerCode.Value = currentrow(18).Trim
                        End If
                        If (currentrow(19).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 20, "Debe indicar el dato type SerialChippingContainerCode de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(19).Trim.ToUpper
                                Case "BJ"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).LogisticUnits.serialShippingContainerCode.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnitsSerialShippingContainerCodeType.BJ
                                Case "SRV"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).LogisticUnits.serialShippingContainerCode.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemLogisticUnitsSerialShippingContainerCodeType.SRV
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 20, "Debe indicar un valor correcto en el dato serialShippingContainerCode type (19) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                    End If
                    If (currentrow(20).Trim <> "" Or currentrow(21).Trim <> "" Or currentrow(22).Trim <> "" Or currentrow(23).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformation()
                        If (currentrow(20).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 21, "Debe indicar el dato palletQuantity (20) de la seccion LINEITEM.", Resp)
                        Else
                            If (currentrow(20).Trim.Length > 15) Then
                                ValidaCFDi.AgregaRespuesta("12", 21, "El dato palletQuantity (20) de la seccion LINEITEM no puede tener una longitud mayor a 15 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.palletQuantity = currentrow(20).Trim
                        End If
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description = New AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescription()
                        If (currentrow(21).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 22, "Debe indciar el dato typeDescription (21) de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(21).Trim.ToUpper
                                Case "EXCHANGE_PALLETS"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.EXCHANGE_PALLETS
                                Case "RETURN_PALLETS"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.RETURN_PALLETS
                                Case "PALLET_80X100"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.PALLET_80x100
                                Case "CASE"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.CASE
                                Case "BOX"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.type = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationDescriptionType.BOX
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 22, "Debe indicar un valor correcto en el dato typeDescription (21) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                        If (currentrow(22).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 23, "Debe indicar el dato description(22) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.Text = New String() {1}
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.description.Text(0) = currentrow(22).Trim
                        End If
                        If (currentrow(23).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 24, "Debe indicar el dato methodOfPayment (23) de la seccion LINEITEM.", Resp)
                        Else
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.transport = New AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationTransport()
                            Select Case currentrow(23).Trim.ToUpper
                                Case "PREPAID_BY_SELLER"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.transport.methodOfPayment = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationTransportMethodOfPayment.PREPAID_BY_SELLER
                                Case "PAID_BY_BUYER"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).palletInformation.transport.methodOfPayment = AMC71.ComprobanteAddendaRequestForPaymentLineItemPalletInformationTransportMethodOfPayment.PAID_BY_BUYER
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 24, "Debe indicar un valor correcto en el dato methodOfPayment (23) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                    End If
                    If (currentrow(24).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).extendedAttributes = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLotNumber() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemLotNumber()}
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).extendedAttributes(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemLotNumber()
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).extendedAttributes(0).Value = currentrow(24).Trim
                        If (currentrow(25).Trim <> "") Then
                            Try
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).extendedAttributes(0).productionDate = CDate(currentrow(25).Trim)
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).extendedAttributes(0).productionDateSpecified = True
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 26, "No se pudo realizar la conversion en fecha extendedAttributes ProductionDate LINEITEM.", Resp)
                            End Try
                        End If
                    End If
                    If (currentrow(26).Trim <> "" Or currentrow(27).Trim <> "" Or currentrow(28).Trim <> "" Or currentrow(29).Trim <> "" Or currentrow(30).Trim <> "" Or _
                       currentrow(31).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceCharge() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceCharge()}
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceCharge()
                        If (currentrow(26).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 27, "Debe indicar el dato AllowanceChargeType (26) en la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(26).Trim.ToUpper
                                Case "ALLOWANCE_GLOBAL"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeAllowanceChargeType.ALLOWANCE_GLOBAL
                                Case "CHARGE_GLOBAL"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).allowanceChargeType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeAllowanceChargeType.CHARGE_GLOBAL
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 27, "Debe indicar un valor correcto en el dato AllowanceChargeType (26) de la seccion LINEITEM. ", Resp)
                            End Select
                        End If
                        If (currentrow(27).Trim <> "") Then
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).settlementType = New Detallista.detallistaLineItemAllowanceChargeSettlementType()
                            Select Case currentrow(26).Trim.ToUpper
                                Case "OFF_INVOICE"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSettlementType.OFF_INVOICE
                                Case "CHARGE_TO_BE_PAID_BY_VENDOR"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSettlementType.CHARGE_TO_BE_PAID_BY_VENDOR
                                Case "CHARGE_TO_BE_PAID_BY_CUSTOMER"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).settlementType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSettlementType.CHARGE_TO_BE_PAID_BY_CUSTOMER
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 27, "Debe indicar un valor correcto en el dato settlementType (27) en la seccion LINEITEM.", Resp)
                            End Select
                        End If
                        If (currentrow(28).Trim <> "") Then
                            If (currentrow(28).Trim.Length > 15) Then
                                ValidaCFDi.AgregaRespuesta("12", 29, "El dato sequenceNumber (28) de la seccion LINEITEM no puede tener una longitud mayor a 15 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).sequenceNumber = currentrow(28).Trim
                        End If
                        If (currentrow(29).Trim <> "") Then
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = New Detallista.detallistaLineItemAllowanceChargeSpecialServicesType()
                            Select Case currentrow(29).Trim.ToUpper
                                Case "AA"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.AA
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ADS"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ADS
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ADO"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ADO
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ABZ"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ABZ
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "DA"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.DA
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "EAA"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.EAA
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "PI"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.PI
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TAE"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TAE
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "SAB"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.SAB
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "RAA"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.RAA
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "PAD"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.PAD
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FG"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FG
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FA"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FA
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TD"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TD
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TS"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TS
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "TX"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.TX
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ZZZ"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ZZZ
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "VAB"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.VAB
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "UM"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.UM
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "DI"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.DI
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "ADT"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.ADT
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "AJ"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.AJ
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "CAC"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.CAC
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "COD"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.COD
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "EAB"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.EAB
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FC"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FC
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "FI"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.FI
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "HD"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.HD
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case "QD"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeSpecialServicesType.QD
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).specialServicesTypeSpecified = True
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 30, "Debe indicar un valor correcto en el campo specialServicesType (28) de la seccion LINEITEM del complemento detallista.", Resp)
                            End Select
                        End If
                        If (currentrow(30).Trim <> "" Or currentrow(31).Trim <> "") Then
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).monetaryAmountOrPercentage = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeMonetaryAmountOrPercentage()
                            If (currentrow(30).Trim = "") Then
                                ValidaCFDi.AgregaRespuesta("12", 31, "Debe indicar el dato percentagePerUnit (30) de la seccion LINEITEM.", Resp)
                            Else
                                If (currentrow(30).Trim.Length > 5) Then
                                    ValidaCFDi.AgregaRespuesta("12", 31, "El dato percentagePerUnit (30) de la seccion LINEITEM no puede tener una longitud mayor a 5 caracteres.", Resp)
                                End If
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).monetaryAmountOrPercentage.percentagePerUnit = currentrow(30)
                            End If
                            If (currentrow(31).Trim = "") Then
                                ValidaCFDi.AgregaRespuesta("12", 32, "Debe indicar el dato amountPerUnit (31) de la seccion LINEITEM.", Resp)
                            Else
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).monetaryAmountOrPercentage.ratePerUnit = New AMC71.ComprobanteAddendaRequestForPaymentLineItemAllowanceChargeMonetaryAmountOrPercentageRatePerUnit()
                                If (currentrow(31).Trim.Length > 5) Then
                                    ValidaCFDi.AgregaRespuesta("12", 32, "El dato amountPerUnit (31) de la seccion LINEITEM no puede tener una longitud mayor a 5 caracteres.", Resp)
                                End If
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).allowanceCharge(0).monetaryAmountOrPercentage.ratePerUnit.amountPerUnit = currentrow(31)
                            End If
                        End If
                    End If
                    If (currentrow(32).Trim <> "" Or currentrow(33).Trim <> "" Or currentrow(34).Trim <> "" Or currentrow(35).Trim <> "" Or currentrow(36).Trim <> "") Then
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()}
                        If (currentrow(32).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 33, "Debe indicar el dato taxTypeDescription (32) de la seccion LINEITEM.", Resp)
                        Else
                            Select Case currentrow(32).Trim.ToUpper
                                Case "GST"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                Case "VAT"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                Case "LAC"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                Case "AAA"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                Case "ADD"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                Case "FRE"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                Case "LOC"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                Case "STT"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                Case "OTH"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                            End Select
                        End If
                        If (currentrow(33).Trim <> "") Then
                            If (currentrow(33).Trim.Length > 20) Then
                                ValidaCFDi.AgregaRespuesta("12", 34, "El dato referenceNumber (33) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                            End If
                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).referenceNumber = currentrow(33).Trim
                        End If
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                        If (currentrow(34).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 35, "Debe indicar el dato taxPercentage (34) de la seccion LINEITEM.", Resp)
                        Else
                            Try
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = CDec(currentrow(34).Trim)
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 35, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                            End Try
                        End If
                        If (currentrow(35).Trim = "") Then
                            ValidaCFDi.AgregaRespuesta("12", 36, "Debe indicar el dato taxAmount (35) de la seccion LINEITEM.", Resp)
                        Else
                            Try
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = CDec(currentrow(35).Trim)
                            Catch ex As Exception
                                ValidaCFDi.AgregaRespuesta("12", 36, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                            End Try
                        End If
                        If (currentrow(36).Trim <> "") Then
                            Select Case currentrow(36).Trim.ToUpper
                                Case "TRANSFERIDO"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategorySpecified = True
                                Case "RETENIDO"
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategorySpecified = True
                                Case Else
                                    ValidaCFDi.AgregaRespuesta("12", 37, "Debe indicar un valor correcto en el dato taxcategory (36) de la seccion LINEITEM.", Resp)
                            End Select
                        End If
                    End If
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).totalLineAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTotalLineAmount()
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).totalLineAmount.grossAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTotalLineAmountGrossAmount()
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).totalLineAmount.grossAmount.Amount = comprobante.Conceptos(i).importe
                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).totalLineAmount.netAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTotalLineAmountNetAmount()
                    Try
                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).totalLineAmount.netAmount.Amount = CDec(currentrow(37).Trim)
                    Catch ex As Exception
                        ValidaCFDi.AgregaRespuesta("12", 38, "No se pudo realizar la conversion a decimal del dato NetAmount LineItem.", Resp)
                    End Try
                    If (currentrow.Length = 48) Then
                        If (currentrow(38).Trim <> "" Or currentrow(39).Trim <> "" Or currentrow(40).Trim <> "" Or currentrow(41).Trim <> "" Or currentrow(42).Trim <> "") Then
                            If (add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation Is Nothing) Then
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()}
                                If (currentrow(38).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 39, "Debe indicar el dato taxTypeDescription (38) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(38).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(39).Trim <> "") Then
                                    If (currentrow(39).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 40, "El dato referenceNumber (39) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).referenceNumber = currentrow(39).Trim
                                End If
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(40).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 41, "Debe indicar el dato taxPercentage (40) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = CDec(currentrow(40).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 41, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(41).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 42, "Debe indicar el dato taxAmount (41) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = CDec(currentrow(41).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 42, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(42).Trim <> "") Then
                                    Select Case currentrow(42).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 43, "Debe indicar un valor correcto en el dato taxcategory (42) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            Else
                                ReDim Preserve add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length)
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()
                                If (currentrow(38).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 39, "Debe indicar el dato taxTypeDescription (38) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(38).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(39).Trim <> "") Then
                                    If (currentrow(39).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 40, "El dato referenceNumber (39) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).referenceNumber = currentrow(39).Trim
                                End If
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(40).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 41, "Debe indicar el dato taxPercentage (40) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxPercentage = CDec(currentrow(40).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 41, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(41).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 42, "Debe indicar el dato taxAmount (41) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxAmount = CDec(currentrow(41).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 42, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(42).Trim <> "") Then
                                    Select Case currentrow(42).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 43, "Debe indicar un valor correcto en el dato taxcategory (42) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            End If
                        End If
                        If (currentrow(43).Trim <> "" Or currentrow(44).Trim <> "" Or currentrow(45).Trim <> "" Or currentrow(46).Trim <> "" Or currentrow(47).Trim <> "") Then
                            If (add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation Is Nothing) Then
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation() {New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()}
                                If (currentrow(43).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 44, "Debe indicar el dato taxTypeDescription (43) de la seccion LINEITEM.", Resp)
                                Else
                                    Select Case currentrow(43).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(44).Trim <> "") Then
                                    If (currentrow(44).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 45, "El dato referenceNumber (44) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).referenceNumber = currentrow(44).Trim
                                End If
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(45).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 46, "Debe indicar el dato taxPercentage (45) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount.taxPercentage = CDec(currentrow(45).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 46, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(46).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 47, "Debe indicar el dato taxAmount (46) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).tradeItemTaxAmount.taxAmount = CDec(currentrow(46).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 47, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(47).Trim <> "") Then
                                    Select Case currentrow(47).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(0).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 48, "Debe indicar un valor correcto en el dato taxcategory (47) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            Else
                                ReDim Preserve add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length)
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformation()
                                If (currentrow(43).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 44, "Debe indicar el dato taxTypeDescription (43) de la seccion LINEITEM.", Resp)
                                    Throw New Exception()
                                Else
                                    Select Case currentrow(43).Trim.ToUpper
                                        Case "GST"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.GST
                                        Case "VAT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.VAT
                                        Case "LAC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LAC
                                        Case "AAA"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.AAA
                                        Case "ADD"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.ADD
                                        Case "FRE"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.FRE
                                        Case "LOC"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.LOC
                                        Case "STT"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.STT
                                        Case "OTH"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxTypeDescription = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxTypeDescription.OTH
                                    End Select
                                End If
                                If (currentrow(44).Trim <> "") Then
                                    If (currentrow(44).Trim.Length > 20) Then
                                        ValidaCFDi.AgregaRespuesta("12", 45, "El dato referenceNumber (44) de la seccion LINEITEM no puede tener una longitud mayor a 20 caracteres.", Resp)
                                    End If
                                    add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).referenceNumber = currentrow(44).Trim
                                End If
                                add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount = New AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTradeItemTaxAmount()
                                If (currentrow(45).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 46, "Debe indicar el dato taxPercentage (45) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxPercentage = CDec(currentrow(45).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 46, "No se pudo realizar la conversion a decimal de taxPercentage LineItem", Resp)
                                    End Try
                                End If
                                If (currentrow(46).Trim = "") Then
                                    ValidaCFDi.AgregaRespuesta("12", 47, "Debe indicar el dato taxAmount (46) de la seccion LINEITEM.", Resp)
                                Else
                                    Try
                                        add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).tradeItemTaxAmount.taxAmount = CDec(currentrow(46).Trim)
                                    Catch ex As Exception
                                        ValidaCFDi.AgregaRespuesta("12", 47, "No se pudo convertir taxAmount LineItem a decimal.", Resp)
                                    End Try
                                End If
                                If (currentrow(47).Trim <> "") Then
                                    Select Case currentrow(47).Trim.ToUpper
                                        Case "TRANSFERIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.TRANSFERIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case "RETENIDO"
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentLineItemTradeItemTaxInformationTaxCategory.RETENIDO
                                            add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation(add.requestForPayment.lineItem(add.requestForPayment.lineItem.Length - 1).tradeItemTaxInformation.Length - 1).taxCategorySpecified = True
                                        Case Else
                                            ValidaCFDi.AgregaRespuesta("12", 48, "Debe indicar un valor correcto en el dato taxcategory (47) de la seccion LINEITEM.", Resp)
                                    End Select
                                End If
                            End If

                        End If
                    End If
                End If
                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 49, "El contenido del documento TXT no es correcto,longitud incorrecta para sección LINEITEM", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaTotalAllowanceCharge(ByVal currentrow As String(), ByRef Resp As List(Of RespuestaPremium), _
                                    ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 5) Then
                If (add.requestForPayment.TotalAllowanceCharge Is Nothing) Then
                    add.requestForPayment.TotalAllowanceCharge = New AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceCharge() {New AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceCharge()}
                    If (currentrow(2) = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato AllowanceOrChargeType(2) de la seccion TOTALALLOWANCECHARGE.", Resp)
                    Else
                        Select Case currentrow(2).ToUpper
                            Case "ALLOWANCE"
                                add.requestForPayment.TotalAllowanceCharge(0).allowanceOrChargeType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeAllowanceOrChargeType.ALLOWANCE
                            Case "CHARGE"
                                add.requestForPayment.TotalAllowanceCharge(0).allowanceOrChargeType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeAllowanceOrChargeType.CHARGE
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar un valor correcto en el dato AllowanceOrChargeType(2) de la seccion TOTALALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    If (currentrow(3) <> "") Then
                        Select Case currentrow(3).ToUpper
                            Case "AA"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.AA
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ADS"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ADS
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ADO"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ADO
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ABZ"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ABZ
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "DA"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.DA
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "EAA"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.EAA
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "PI"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.PI
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TAE"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TAE
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "SAB"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.SAB
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "RAA"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.RAA
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "PAD"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.PAD
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FG"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FG
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FA"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FA
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TD"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TD
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TS"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TS
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "TX"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TX
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ZZZ"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ZZZ
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "VAB"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.VAB
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "UM"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.UM
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "DI"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.DI
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "ADT"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ADT
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "AJ"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.AJ
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "CAC"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.CAC
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "COD"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.COD
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "EAB"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.EAB
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FC"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FC
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "FI"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FI
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "HD"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.HD
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case "QD"
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.QD
                                add.requestForPayment.TotalAllowanceCharge(0).specialServicesTypeSpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar un valor correcto en el campo specialServicesType (3) de la seccion TOTALALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    If (currentrow(4) <> "") Then
                        Try
                            add.requestForPayment.TotalAllowanceCharge(0).Amount = CDec(currentrow(4))
                            add.requestForPayment.TotalAllowanceCharge(0).AmountSpecified = True
                        Catch ex As Exception
                            ValidaCFDi.AgregaRespuesta("12", 5, "No se pudo realizar la conversion a decimal el dato Amount (4) de la seccion TOTALALLOWANCECHARGE.", Resp)
                        End Try
                    End If
                Else
                    ReDim Preserve add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length)
                    add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceCharge()
                    If (currentrow(2) = "") Then
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato AllowanceOrChargeType(2) de la seccion TOTALALLOWANCECHARGE.", Resp)
                    Else
                        Select Case currentrow(2).ToUpper
                            Case "ALLOWANCE"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).allowanceOrChargeType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeAllowanceOrChargeType.ALLOWANCE
                            Case "CHARGE"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).allowanceOrChargeType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeAllowanceOrChargeType.CHARGE
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar un valor correcto en el dato AllowanceOrChargeType(2) de la seccion TOTALALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    If (currentrow(3) <> "") Then
                        Select Case currentrow(3).ToUpper
                            Case "AA"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.AA
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ADS"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ADS
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ADO"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ADO
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ABZ"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ABZ
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "DA"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.DA
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "EAA"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.EAA
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "PI"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.PI
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TAE"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TAE
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "SAB"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.SAB
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "RAA"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.RAA
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "PAD"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.PAD
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FG"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FG
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FA"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FA
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TD"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TD
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TS"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TS
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "TX"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.TX
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ZZZ"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ZZZ
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "VAB"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.VAB
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "UM"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.UM
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "DI"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.DI
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "ADT"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.ADT
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "AJ"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.AJ
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "CAC"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.CAC
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "COD"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.COD
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "EAB"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.EAB
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FC"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FC
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "FI"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.FI
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "HD"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.HD
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case "QD"
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesType = AMC71.ComprobanteAddendaRequestForPaymentTotalAllowanceChargeSpecialServicesType.QD
                                add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).specialServicesTypeSpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 4, "Debe indicar un valor correcto en el campo specialServicesType (3) de la seccion TOTALALLOWANCECHARGE.", Resp)
                        End Select
                    End If
                    If (currentrow(4) <> "") Then
                        Try
                            add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).Amount = CDec(currentrow(4))
                            add.requestForPayment.TotalAllowanceCharge(add.requestForPayment.TotalAllowanceCharge.Length - 1).AmountSpecified = True
                        Catch ex As Exception
                            ValidaCFDi.AgregaRespuesta("12", 5, "No se pudo realizar la conversion a decimal el dato Amount (4) de la seccion TOTALALLOWANCECHARGE.", Resp)
                        End Try
                    End If

                End If

                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección TOTALALLOWANCECHARGE", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function
    Public Function ProcesaTax(ByVal currentrow As String(), _
                               ByRef Resp As List(Of RespuestaPremium), ByRef add As AMC71.ComprobanteAddenda)
        Try
            If (currentrow.Length = 6) Then
                If (add.requestForPayment.tax Is Nothing) Then
                    add.requestForPayment.tax = New AMC71.ComprobanteAddendaRequestForPaymentTax() {New AMC71.ComprobanteAddendaRequestForPaymentTax()}
                    ReDim add.requestForPayment.tax(0)
                    add.requestForPayment.tax(0) = New AMC71.ComprobanteAddendaRequestForPaymentTax()
                    If (currentrow(2).Trim <> "") Then
                        Select Case currentrow(2).Trim
                            Case "GST"
                                add.requestForPayment.tax(0).type = AMC71.ComprobanteAddendaRequestForPaymentTaxType.GST
                                add.requestForPayment.tax(0).typeSpecified = True
                            Case "VAT"
                                add.requestForPayment.tax(0).type = AMC71.ComprobanteAddendaRequestForPaymentTaxType.VAT
                                add.requestForPayment.tax(0).typeSpecified = True
                            Case "LAC"
                                add.requestForPayment.tax(0).type = AMC71.ComprobanteAddendaRequestForPaymentTaxType.LAC
                                add.requestForPayment.tax(0).typeSpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "El dato type de la seccion TAX tiene un valor incorrecto", Resp)
                        End Select
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato type de la seccion TAX.", Resp)
                    End If
                    If (currentrow(3).Trim <> "") Then
                        add.requestForPayment.tax(0).taxPercentage = CDec(currentrow(3).Trim)
                        add.requestForPayment.tax(0).taxPercentageSpecified = True
                    End If
                    If (currentrow(4).Trim <> "") Then
                        add.requestForPayment.tax(0).taxAmount = CDec(currentrow(4).Trim)
                        add.requestForPayment.tax(0).taxAmountSpecified = True
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 5, "Debe indicar el dato taxAmount de la seccion TAX.", Resp)
                    End If
                    If (currentrow(5).Trim <> "") Then
                        Select Case currentrow(5).Trim
                            Case "TRANSFERIDO"
                                add.requestForPayment.tax(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentTaxTaxCategory.TRANSFERIDO
                                add.requestForPayment.tax(0).taxCategorySpecified = True
                            Case "RETENIDO"
                                add.requestForPayment.tax(0).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentTaxTaxCategory.RETENIDO
                                add.requestForPayment.tax(0).taxCategorySpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 6, "El dato taxCategory tiene un valor incorrecto.", Resp)
                        End Select
                    End If
                Else
                    ReDim Preserve add.requestForPayment.tax(add.requestForPayment.tax.Length)
                    add.requestForPayment.tax(add.requestForPayment.tax.Length - 1) = New AMC71.ComprobanteAddendaRequestForPaymentTax()
                    If (currentrow(2).Trim <> "") Then
                        Select Case currentrow(2).Trim
                            Case "GST"
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).type = AMC71.ComprobanteAddendaRequestForPaymentTaxType.GST
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).typeSpecified = True
                            Case "VAT"
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).type = AMC71.ComprobanteAddendaRequestForPaymentTaxType.VAT
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).typeSpecified = True
                            Case "LAC"
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).type = AMC71.ComprobanteAddendaRequestForPaymentTaxType.LAC
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).typeSpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 3, "El dato type de la seccion TAX tiene un valor incorrecto", Resp)
                        End Select
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 3, "Debe indicar el dato type de la seccion TAX.", Resp)
                    End If
                    If (currentrow(3).Trim <> "") Then
                        add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxPercentage = CDec(currentrow(3).Trim)
                        add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxPercentageSpecified = True
                    End If
                    If (currentrow(4).Trim <> "") Then
                        add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxAmount = CDec(currentrow(4).Trim)
                        add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxAmountSpecified = True
                    Else
                        ValidaCFDi.AgregaRespuesta("12", 5, "Debe indicar el dato taxAmount de la seccion TAX.", Resp)
                    End If
                    If (currentrow(5).Trim <> "") Then
                        Select Case currentrow(5).Trim
                            Case "TRANSFERIDO"
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentTaxTaxCategory.TRANSFERIDO
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxCategorySpecified = True
                            Case "RETENIDO"
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxCategory = AMC71.ComprobanteAddendaRequestForPaymentTaxTaxCategory.RETENIDO
                                add.requestForPayment.tax(add.requestForPayment.tax.Length - 1).taxCategorySpecified = True
                            Case Else
                                ValidaCFDi.AgregaRespuesta("12", 6, "El dato taxCategory tiene un valor incorrecto.", Resp)
                        End Select
                    End If
                End If
                Return True
            Else
                ValidaCFDi.AgregaRespuesta("12", 0, "El contenido del documento TXT no es correcto,longitud incorrecta para sección TAX", Resp)
                Return False
            End If
        Catch ex As Exception
            ValidaCFDi.AgregaRespuesta("12", 0, ex.Message, Resp)
            Return False
        End Try
    End Function

End Class
